@awell-health/awell-extensions 1.1.65 → 1.1.67
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/elation/constants.d.ts +1 -0
- package/dist/extensions/elation/constants.js +5 -0
- package/dist/extensions/elation/constants.js.map +1 -0
- package/dist/extensions/elation/types/webhooks/appointments.d.ts +69 -0
- package/dist/extensions/elation/types/webhooks/appointments.js +27 -0
- package/dist/extensions/elation/types/webhooks/appointments.js.map +1 -0
- package/dist/extensions/elation/types/webhooks/webhooks.test.d.ts +1 -0
- package/dist/extensions/elation/types/webhooks/webhooks.test.js +65 -0
- package/dist/extensions/elation/types/webhooks/webhooks.test.js.map +1 -0
- package/dist/extensions/elation/webhooks/appointmentCreatedOrUpdated.js +9 -3
- package/dist/extensions/elation/webhooks/appointmentCreatedOrUpdated.js.map +1 -1
- package/package.json +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
export declare const ELATION_SYSTEM = "https://www.elationhealth.com/";
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../extensions/elation/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,gCAAgC,CAAA"}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import z from 'zod';
|
2
|
+
/**
|
3
|
+
* This is not the full payload, only the most interesting parts
|
4
|
+
*/
|
5
|
+
export declare const AppointmentsPayloadSchema: z.ZodObject<{
|
6
|
+
event_id: z.ZodNumber;
|
7
|
+
application_id: z.ZodString;
|
8
|
+
resource: z.ZodString;
|
9
|
+
action: z.ZodEnum<["saved", "deleted"]>;
|
10
|
+
data: z.ZodObject<{
|
11
|
+
id: z.ZodNumber;
|
12
|
+
scheduled_date: z.ZodDate;
|
13
|
+
duration: z.ZodNumber;
|
14
|
+
reason: z.ZodString;
|
15
|
+
mode: z.ZodString;
|
16
|
+
patient: z.ZodNumber;
|
17
|
+
physician: z.ZodNumber;
|
18
|
+
practice: z.ZodNumber;
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
20
|
+
duration: number;
|
21
|
+
id: number;
|
22
|
+
mode: string;
|
23
|
+
patient: number;
|
24
|
+
reason: string;
|
25
|
+
scheduled_date: Date;
|
26
|
+
physician: number;
|
27
|
+
practice: number;
|
28
|
+
}, {
|
29
|
+
duration: number;
|
30
|
+
id: number;
|
31
|
+
mode: string;
|
32
|
+
patient: number;
|
33
|
+
reason: string;
|
34
|
+
scheduled_date: Date;
|
35
|
+
physician: number;
|
36
|
+
practice: number;
|
37
|
+
}>;
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
39
|
+
data: {
|
40
|
+
duration: number;
|
41
|
+
id: number;
|
42
|
+
mode: string;
|
43
|
+
patient: number;
|
44
|
+
reason: string;
|
45
|
+
scheduled_date: Date;
|
46
|
+
physician: number;
|
47
|
+
practice: number;
|
48
|
+
};
|
49
|
+
resource: string;
|
50
|
+
action: "saved" | "deleted";
|
51
|
+
event_id: number;
|
52
|
+
application_id: string;
|
53
|
+
}, {
|
54
|
+
data: {
|
55
|
+
duration: number;
|
56
|
+
id: number;
|
57
|
+
mode: string;
|
58
|
+
patient: number;
|
59
|
+
reason: string;
|
60
|
+
scheduled_date: Date;
|
61
|
+
physician: number;
|
62
|
+
practice: number;
|
63
|
+
};
|
64
|
+
resource: string;
|
65
|
+
action: "saved" | "deleted";
|
66
|
+
event_id: number;
|
67
|
+
application_id: string;
|
68
|
+
}>;
|
69
|
+
export type AppointmentsPayload = z.infer<typeof AppointmentsPayloadSchema>;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.AppointmentsPayloadSchema = void 0;
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
8
|
+
/**
|
9
|
+
* This is not the full payload, only the most interesting parts
|
10
|
+
*/
|
11
|
+
exports.AppointmentsPayloadSchema = zod_1.default.object({
|
12
|
+
event_id: zod_1.default.number(),
|
13
|
+
application_id: zod_1.default.string(),
|
14
|
+
resource: zod_1.default.string(),
|
15
|
+
action: zod_1.default.enum(['saved', 'deleted']),
|
16
|
+
data: zod_1.default.object({
|
17
|
+
id: zod_1.default.number(),
|
18
|
+
scheduled_date: zod_1.default.coerce.date(),
|
19
|
+
duration: zod_1.default.number(),
|
20
|
+
reason: zod_1.default.string(),
|
21
|
+
mode: zod_1.default.string(),
|
22
|
+
patient: zod_1.default.number(),
|
23
|
+
physician: zod_1.default.number(),
|
24
|
+
practice: zod_1.default.number(),
|
25
|
+
}),
|
26
|
+
});
|
27
|
+
//# sourceMappingURL=appointments.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"appointments.js","sourceRoot":"","sources":["../../../../../extensions/elation/types/webhooks/appointments.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAmB;AAEnB;;GAEG;AACU,QAAA,yBAAyB,GAAG,aAAC,CAAC,MAAM,CAAC;IAChD,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE;IACpB,cAAc,EAAE,aAAC,CAAC,MAAM,EAAE;IAC1B,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE;IACpB,MAAM,EAAE,aAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACpC,IAAI,EAAE,aAAC,CAAC,MAAM,CAAC;QACb,EAAE,EAAE,aAAC,CAAC,MAAM,EAAE;QACd,cAAc,EAAE,aAAC,CAAC,MAAM,CAAC,IAAI,EAAE;QAC/B,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE;QACpB,MAAM,EAAE,aAAC,CAAC,MAAM,EAAE;QAClB,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,aAAC,CAAC,MAAM,EAAE;QACnB,SAAS,EAAE,aAAC,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE;KACrB,CAAC;CACH,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const appointments_1 = require("./appointments");
|
4
|
+
describe('appointments', () => {
|
5
|
+
it('Parses appointments payload without errors', () => {
|
6
|
+
const payload = {
|
7
|
+
event_id: 683401,
|
8
|
+
application_id: 'iGhPjb2udF4oVDa2MMTNX6gcDk1SR5nl0Vdx1Fhw',
|
9
|
+
resource: 'appointments',
|
10
|
+
action: 'saved',
|
11
|
+
data: {
|
12
|
+
id: 142508453527642,
|
13
|
+
scheduled_date: '2024-09-06T10:15:00Z',
|
14
|
+
duration: 15,
|
15
|
+
billing_details: null,
|
16
|
+
payment: null,
|
17
|
+
time_slot_type: 'appointment',
|
18
|
+
time_slot_status: null,
|
19
|
+
reason: 'Follow-Up',
|
20
|
+
mode: 'IN_PERSON',
|
21
|
+
description: '',
|
22
|
+
status: {
|
23
|
+
status: 'Scheduled',
|
24
|
+
room: null,
|
25
|
+
status_date: '2024-09-06T10:03:54Z',
|
26
|
+
status_detail: null,
|
27
|
+
},
|
28
|
+
patient: 141986488057857,
|
29
|
+
patient_forms: {
|
30
|
+
patient_can_receive_forms: false,
|
31
|
+
anonymous_url: null,
|
32
|
+
overrides: [],
|
33
|
+
short_code: null,
|
34
|
+
statuses: [],
|
35
|
+
hours_prior: null,
|
36
|
+
},
|
37
|
+
physician: 141377681883138,
|
38
|
+
practice: 141127173275652,
|
39
|
+
instructions: '',
|
40
|
+
recurring_event_schedule: null,
|
41
|
+
metadata: null,
|
42
|
+
created_date: '2024-09-06T10:03:54Z',
|
43
|
+
last_modified_date: '2024-09-06T10:03:54Z',
|
44
|
+
deleted_date: null,
|
45
|
+
service_location: {
|
46
|
+
id: 141127173341431,
|
47
|
+
name: 'Awell Test Account',
|
48
|
+
is_primary: true,
|
49
|
+
place_of_service: null,
|
50
|
+
address_line1: '1234 Elation Dr',
|
51
|
+
address_line2: 'Apt. 989',
|
52
|
+
city: 'San Francisco',
|
53
|
+
state: 'CA',
|
54
|
+
zip: '94114',
|
55
|
+
phone: '555555555555',
|
56
|
+
created_date: '2022-11-10T23:21:13Z',
|
57
|
+
deleted_date: null,
|
58
|
+
},
|
59
|
+
telehealth_details: null,
|
60
|
+
},
|
61
|
+
};
|
62
|
+
expect(() => appointments_1.AppointmentsPayloadSchema.parse(payload)).not.toThrow();
|
63
|
+
});
|
64
|
+
});
|
65
|
+
//# sourceMappingURL=webhooks.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"webhooks.test.js","sourceRoot":"","sources":["../../../../../extensions/elation/types/webhooks/webhooks.test.ts"],"names":[],"mappings":";;AAAA,iDAA0D;AAE1D,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,OAAO,GAAG;YACd,QAAQ,EAAE,MAAM;YAChB,cAAc,EAAE,0CAA0C;YAC1D,QAAQ,EAAE,cAAc;YACxB,MAAM,EAAE,OAAO;YACf,IAAI,EAAE;gBACJ,EAAE,EAAE,eAAe;gBACnB,cAAc,EAAE,sBAAsB;gBACtC,QAAQ,EAAE,EAAE;gBACZ,eAAe,EAAE,IAAI;gBACrB,OAAO,EAAE,IAAI;gBACb,cAAc,EAAE,aAAa;gBAC7B,gBAAgB,EAAE,IAAI;gBACtB,MAAM,EAAE,WAAW;gBACnB,IAAI,EAAE,WAAW;gBACjB,WAAW,EAAE,EAAE;gBACf,MAAM,EAAE;oBACN,MAAM,EAAE,WAAW;oBACnB,IAAI,EAAE,IAAI;oBACV,WAAW,EAAE,sBAAsB;oBACnC,aAAa,EAAE,IAAI;iBACpB;gBACD,OAAO,EAAE,eAAe;gBACxB,aAAa,EAAE;oBACb,yBAAyB,EAAE,KAAK;oBAChC,aAAa,EAAE,IAAI;oBACnB,SAAS,EAAE,EAAE;oBACb,UAAU,EAAE,IAAI;oBAChB,QAAQ,EAAE,EAAE;oBACZ,WAAW,EAAE,IAAI;iBAClB;gBACD,SAAS,EAAE,eAAe;gBAC1B,QAAQ,EAAE,eAAe;gBACzB,YAAY,EAAE,EAAE;gBAChB,wBAAwB,EAAE,IAAI;gBAC9B,QAAQ,EAAE,IAAI;gBACd,YAAY,EAAE,sBAAsB;gBACpC,kBAAkB,EAAE,sBAAsB;gBAC1C,YAAY,EAAE,IAAI;gBAClB,gBAAgB,EAAE;oBAChB,EAAE,EAAE,eAAe;oBACnB,IAAI,EAAE,oBAAoB;oBAC1B,UAAU,EAAE,IAAI;oBAChB,gBAAgB,EAAE,IAAI;oBACtB,aAAa,EAAE,iBAAiB;oBAChC,aAAa,EAAE,UAAU;oBACzB,IAAI,EAAE,eAAe;oBACrB,KAAK,EAAE,IAAI;oBACX,GAAG,EAAE,OAAO;oBACZ,KAAK,EAAE,cAAc;oBACrB,YAAY,EAAE,sBAAsB;oBACpC,YAAY,EAAE,IAAI;iBACnB;gBACD,kBAAkB,EAAE,IAAI;aACzB;SACF,CAAA;QAED,MAAM,CAAC,GAAG,EAAE,CAAC,wCAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.appointmentCreatedOrUpdated = void 0;
|
4
|
+
const constants_1 = require("../constants");
|
5
|
+
const appointments_1 = require("../types/webhooks/appointments");
|
4
6
|
const dataPoints = {
|
5
7
|
appointmentId: {
|
6
8
|
key: 'appointmentId',
|
@@ -11,8 +13,8 @@ exports.appointmentCreatedOrUpdated = {
|
|
11
13
|
key: 'appointmentCreatedOrUpdated',
|
12
14
|
dataPoints,
|
13
15
|
onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
|
14
|
-
const {
|
15
|
-
// skip non 'saved'
|
16
|
+
const { action, resource, data: { id: appointmentId, patient: patientId }, } = appointments_1.AppointmentsPayloadSchema.parse(payload);
|
17
|
+
// skip non 'saved' actions for that webhook
|
16
18
|
if (action !== 'saved') {
|
17
19
|
return;
|
18
20
|
}
|
@@ -26,7 +28,11 @@ exports.appointmentCreatedOrUpdated = {
|
|
26
28
|
}
|
27
29
|
else {
|
28
30
|
await onSuccess({
|
29
|
-
data_points: { appointmentId: String(
|
31
|
+
data_points: { appointmentId: String(appointmentId) },
|
32
|
+
patient_identifier: {
|
33
|
+
system: constants_1.ELATION_SYSTEM,
|
34
|
+
value: String(patientId),
|
35
|
+
},
|
30
36
|
});
|
31
37
|
}
|
32
38
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"appointmentCreatedOrUpdated.js","sourceRoot":"","sources":["../../../../extensions/elation/webhooks/appointmentCreatedOrUpdated.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"appointmentCreatedOrUpdated.js","sourceRoot":"","sources":["../../../../extensions/elation/webhooks/appointmentCreatedOrUpdated.ts"],"names":[],"mappings":";;;AAIA,4CAA6C;AAE7C,iEAA0E;AAE1E,MAAM,UAAU,GAAG;IACjB,aAAa,EAAE;QACb,GAAG,EAAE,eAAe;QACpB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,2BAA2B,GAGpC;IACF,GAAG,EAAE,6BAA6B;IAClC,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACrE,MAAM,EACJ,MAAM,EACN,QAAQ,EACR,IAAI,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,GAChD,GAAG,wCAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAE5C,6CAA6C;QAC7C,IAAI,MAAM,KAAK,OAAO,EAAE;YACtB,OAAM;SACP;QAED,IAAI,QAAQ,KAAK,cAAc,EAAE;YAC/B,MAAM,OAAO,CAAC;gBACZ,QAAQ,EAAE;oBACR,UAAU,EAAE,GAAG;oBACf,OAAO,EAAE,gCAAgC;iBAC1C;aACF,CAAC,CAAA;SACH;aAAM;YACL,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,EAAE;gBACrD,kBAAkB,EAAE;oBAClB,MAAM,EAAE,0BAAc;oBACtB,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC;iBACzB;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF,CAAA"}
|