@awell-health/awell-extensions 1.1.40 → 1.1.42-beta14
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/awell/v1/webhooks/index.d.ts +1 -1
- package/dist/extensions/awell/v1/webhooks/pathwayStart.js +12 -3
- package/dist/extensions/awell/v1/webhooks/pathwayStart.js.map +1 -1
- package/dist/extensions/calDotCom/webhooks/index.d.ts +1 -1
- package/dist/extensions/calendly/webhooks/index.d.ts +1 -1
- package/dist/extensions/collectData/v1/actions/collectMedication/config/datapoints.d.ts +4 -0
- package/dist/extensions/collectData/v1/actions/collectMedication/config/datapoints.js +4 -0
- package/dist/extensions/collectData/v1/actions/collectMedication/config/datapoints.js.map +1 -1
- package/dist/extensions/elation/actions/updatePatient.js +1 -0
- package/dist/extensions/elation/actions/updatePatient.js.map +1 -1
- package/dist/extensions/elation/webhooks/index.d.ts +1 -1
- package/dist/extensions/healthie/lib/sdk/generated/sdk.d.ts +373 -9
- package/dist/extensions/healthie/lib/sdk/generated/sdk.js +110 -3
- package/dist/extensions/healthie/lib/sdk/generated/sdk.js.map +1 -1
- package/dist/extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.d.ts +11 -1
- package/dist/extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.js +15 -1
- package/dist/extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.js.map +1 -1
- package/dist/extensions/healthie/lib/types.d.ts +1 -0
- package/dist/extensions/healthie/lib/types.js +2 -0
- package/dist/extensions/healthie/lib/types.js.map +1 -1
- package/dist/extensions/healthie/webhooks/appliedTagCreated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/appliedTagCreated.js +33 -12
- package/dist/extensions/healthie/webhooks/appliedTagCreated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/appliedTagDeleted.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/appliedTagDeleted.js +33 -12
- package/dist/extensions/healthie/webhooks/appliedTagDeleted.js.map +1 -1
- package/dist/extensions/healthie/webhooks/appointmentCreated.d.ts +6 -1
- package/dist/extensions/healthie/webhooks/appointmentCreated.js +40 -12
- package/dist/extensions/healthie/webhooks/appointmentCreated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/appointmentDeleted.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/appointmentDeleted.js +36 -12
- package/dist/extensions/healthie/webhooks/appointmentDeleted.js.map +1 -1
- package/dist/extensions/healthie/webhooks/appointmentUpdated.d.ts +6 -1
- package/dist/extensions/healthie/webhooks/appointmentUpdated.js +40 -12
- package/dist/extensions/healthie/webhooks/appointmentUpdated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/formAnswerGroupCreated.d.ts +6 -1
- package/dist/extensions/healthie/webhooks/formAnswerGroupCreated.js +40 -12
- package/dist/extensions/healthie/webhooks/formAnswerGroupCreated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/formAnswerGroupDeleted.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/formAnswerGroupDeleted.js +35 -12
- package/dist/extensions/healthie/webhooks/formAnswerGroupDeleted.js.map +1 -1
- package/dist/extensions/healthie/webhooks/formAnswerGroupLocked.d.ts +6 -1
- package/dist/extensions/healthie/webhooks/formAnswerGroupLocked.js +40 -12
- package/dist/extensions/healthie/webhooks/formAnswerGroupLocked.js.map +1 -1
- package/dist/extensions/healthie/webhooks/formAnswerGroupSigned.d.ts +6 -1
- package/dist/extensions/healthie/webhooks/formAnswerGroupSigned.js +40 -12
- package/dist/extensions/healthie/webhooks/formAnswerGroupSigned.js.map +1 -1
- package/dist/extensions/healthie/webhooks/goalCreated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/goalCreated.js +34 -13
- package/dist/extensions/healthie/webhooks/goalCreated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/goalUpdated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/goalUpdated.js +34 -13
- package/dist/extensions/healthie/webhooks/goalUpdated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/index.d.ts +316 -1
- package/dist/extensions/healthie/webhooks/labOrderCreated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/labOrderCreated.js +33 -12
- package/dist/extensions/healthie/webhooks/labOrderCreated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/labOrderUpdated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/labOrderUpdated.js +33 -12
- package/dist/extensions/healthie/webhooks/labOrderUpdated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/messageCreated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/messageCreated.js +35 -13
- package/dist/extensions/healthie/webhooks/messageCreated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/messageDeleted.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/messageDeleted.js +35 -13
- package/dist/extensions/healthie/webhooks/messageDeleted.js.map +1 -1
- package/dist/extensions/healthie/webhooks/metricEntryCreated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/metricEntryCreated.js +33 -12
- package/dist/extensions/healthie/webhooks/metricEntryCreated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/metricEntryUpdated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/metricEntryUpdated.js +33 -12
- package/dist/extensions/healthie/webhooks/metricEntryUpdated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/patientCreated.js +5 -0
- package/dist/extensions/healthie/webhooks/patientCreated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/patientUpdated.js +5 -0
- package/dist/extensions/healthie/webhooks/patientUpdated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/requestedFormCompletionCreated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/requestedFormCompletionCreated.js +33 -12
- package/dist/extensions/healthie/webhooks/requestedFormCompletionCreated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/requestedFormCompletionUpdated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/requestedFormCompletionUpdated.js +33 -12
- package/dist/extensions/healthie/webhooks/requestedFormCompletionUpdated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/taskCreated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/taskCreated.js +33 -12
- package/dist/extensions/healthie/webhooks/taskCreated.js.map +1 -1
- package/dist/extensions/healthie/webhooks/taskUpdated.d.ts +2 -1
- package/dist/extensions/healthie/webhooks/taskUpdated.js +33 -12
- package/dist/extensions/healthie/webhooks/taskUpdated.js.map +1 -1
- package/dist/extensions/hello-world/webhooks/index.d.ts +1 -1
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/zusHealth/webhooks/index.d.ts +37 -1
- package/dist/extensions/zusHealth/webhooks/patientAdmitted.d.ts +2 -1
- package/dist/extensions/zusHealth/webhooks/patientAdmitted.js.map +1 -1
- package/dist/extensions/zusHealth/webhooks/patientDischarged.d.ts +2 -1
- package/dist/extensions/zusHealth/webhooks/patientDischarged.js.map +1 -1
- package/dist/src/test-server.js +4 -0
- package/dist/src/test-server.js.map +1 -1
- package/package.json +4 -3
@@ -1,7 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.messageCreated = void 0;
|
4
7
|
const lodash_1 = require("lodash");
|
8
|
+
const types_1 = require("../lib/types");
|
9
|
+
const zod_1 = __importDefault(require("zod"));
|
10
|
+
const validatePayloadAndCreateSdk_1 = require("../lib/sdk/validatePayloadAndCreateSdk");
|
11
|
+
const payloadSchema = zod_1.default
|
12
|
+
.object({
|
13
|
+
resource_id: zod_1.default.string(),
|
14
|
+
})
|
15
|
+
.transform((data) => {
|
16
|
+
return {
|
17
|
+
createdMessageId: data.resource_id,
|
18
|
+
};
|
19
|
+
});
|
5
20
|
const dataPoints = {
|
6
21
|
createdMessageId: {
|
7
22
|
key: 'createdMessageId',
|
@@ -12,19 +27,26 @@ exports.messageCreated = {
|
|
12
27
|
key: 'messageCreated',
|
13
28
|
dataPoints,
|
14
29
|
onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
30
|
+
var _a, _b, _c, _d;
|
31
|
+
const { validatedPayload: { createdMessageId }, sdk, } = await (0, validatePayloadAndCreateSdk_1.validateWebhookPayloadAndCreateSdk)({
|
32
|
+
payloadSchema,
|
33
|
+
payload,
|
34
|
+
settings,
|
35
|
+
});
|
36
|
+
const messageResponse = await sdk.getMessage({ id: createdMessageId });
|
37
|
+
const conversationResponse = await sdk.getConversation({ id: (_b = (_a = messageResponse === null || messageResponse === void 0 ? void 0 : messageResponse.data) === null || _a === void 0 ? void 0 : _a.note) === null || _b === void 0 ? void 0 : _b.conversation_id });
|
38
|
+
const healthiePatientId = (_d = (_c = conversationResponse === null || conversationResponse === void 0 ? void 0 : conversationResponse.data) === null || _c === void 0 ? void 0 : _c.conversation) === null || _d === void 0 ? void 0 : _d.patient_id;
|
39
|
+
await onSuccess({
|
40
|
+
data_points: {
|
41
|
+
createdMessageId,
|
42
|
+
},
|
43
|
+
...(!(0, lodash_1.isNil)(healthiePatientId) && {
|
44
|
+
patient_identifier: {
|
45
|
+
system: types_1.HEALTHIE_IDENTIFIER,
|
46
|
+
value: healthiePatientId,
|
47
|
+
}
|
48
|
+
})
|
49
|
+
});
|
28
50
|
},
|
29
51
|
};
|
30
52
|
//# sourceMappingURL=messageCreated.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"messageCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/messageCreated.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"messageCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/messageCreated.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAK9B,wCAA+E;AAC/E,8CAAmB;AACnB,wFAA2F;AAG3F,MAAM,aAAa,GAAG,aAAC;KACpB,MAAM,CAAC;IACN,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;CACxB,CAAC;KACD,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;IAClB,OAAO;QACL,gBAAgB,EAAE,IAAI,CAAC,WAAW;KACnC,CAAA;AACH,CAAC,CAAC,CAAA;AAEJ,MAAM,UAAU,GAAG;IACjB,gBAAgB,EAAE;QAChB,GAAG,EAAE,kBAAkB;QACvB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,cAAc,GAIvB;IACF,GAAG,EAAE,gBAAgB;IACrB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;;QACrE,MAAM,EACJ,gBAAgB,EAAE,EAAE,gBAAgB,EAAE,EACtC,GAAG,GACJ,GAAG,MAAM,IAAA,gEAAkC,EAAC;YAC3C,aAAa;YACb,OAAO;YACP,QAAQ;SACT,CAAC,CAAA;QACF,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAA;QACtE,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,eAAe,CAAC,EAAE,EAAE,EAAE,MAAA,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI,0CAAE,IAAI,0CAAE,eAAe,EAAE,CAAC,CAAA;QAC5G,MAAM,iBAAiB,GAAG,MAAA,MAAA,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,0CAAE,YAAY,0CAAE,UAAU,CAAA;QAC9E,MAAM,SAAS,CAAC;YACd,WAAW,EAAE;gBACX,gBAAgB;aACjB;YACD,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,iBAAiB,CAAC,IAAI;gBAC/B,kBAAkB,EAAE;oBAClB,MAAM,EAAE,2BAAmB;oBAC3B,KAAK,EAAE,iBAAiB;iBACzB;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { type Webhook } from '@awell-health/extensions-core';
|
2
2
|
import { type HealthieWebhookPayload } from '../lib/types';
|
3
|
+
import { type settings } from '../settings';
|
3
4
|
declare const dataPoints: {
|
4
5
|
deletedMessageId: {
|
5
6
|
key: string;
|
6
7
|
valueType: "string";
|
7
8
|
};
|
8
9
|
};
|
9
|
-
export declare const messageDeleted: Webhook<keyof typeof dataPoints, HealthieWebhookPayload>;
|
10
|
+
export declare const messageDeleted: Webhook<keyof typeof dataPoints, HealthieWebhookPayload, typeof settings>;
|
10
11
|
export type MessageDeleted = typeof messageDeleted;
|
11
12
|
export {};
|
@@ -1,7 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.messageDeleted = void 0;
|
4
7
|
const lodash_1 = require("lodash");
|
8
|
+
const types_1 = require("../lib/types");
|
9
|
+
const zod_1 = __importDefault(require("zod"));
|
10
|
+
const validatePayloadAndCreateSdk_1 = require("../lib/sdk/validatePayloadAndCreateSdk");
|
11
|
+
const payloadSchema = zod_1.default
|
12
|
+
.object({
|
13
|
+
resource_id: zod_1.default.string(),
|
14
|
+
})
|
15
|
+
.transform((data) => {
|
16
|
+
return {
|
17
|
+
deletedMessageId: data.resource_id,
|
18
|
+
};
|
19
|
+
});
|
5
20
|
const dataPoints = {
|
6
21
|
deletedMessageId: {
|
7
22
|
key: 'deletedMessageId',
|
@@ -12,19 +27,26 @@ exports.messageDeleted = {
|
|
12
27
|
key: 'messageDeleted',
|
13
28
|
dataPoints,
|
14
29
|
onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
30
|
+
var _a, _b, _c, _d;
|
31
|
+
const { validatedPayload: { deletedMessageId }, sdk, } = await (0, validatePayloadAndCreateSdk_1.validateWebhookPayloadAndCreateSdk)({
|
32
|
+
payloadSchema,
|
33
|
+
payload,
|
34
|
+
settings,
|
35
|
+
});
|
36
|
+
const messageResponse = await sdk.getMessage({ id: deletedMessageId });
|
37
|
+
const conversationResponse = await sdk.getConversation({ id: (_b = (_a = messageResponse === null || messageResponse === void 0 ? void 0 : messageResponse.data) === null || _a === void 0 ? void 0 : _a.note) === null || _b === void 0 ? void 0 : _b.conversation_id });
|
38
|
+
const healthiePatientId = (_d = (_c = conversationResponse === null || conversationResponse === void 0 ? void 0 : conversationResponse.data) === null || _c === void 0 ? void 0 : _c.conversation) === null || _d === void 0 ? void 0 : _d.patient_id;
|
39
|
+
await onSuccess({
|
40
|
+
data_points: {
|
41
|
+
deletedMessageId,
|
42
|
+
},
|
43
|
+
...(!(0, lodash_1.isNil)(healthiePatientId) && {
|
44
|
+
patient_identifier: {
|
45
|
+
system: types_1.HEALTHIE_IDENTIFIER,
|
46
|
+
value: healthiePatientId,
|
47
|
+
}
|
48
|
+
}),
|
49
|
+
});
|
28
50
|
},
|
29
51
|
};
|
30
52
|
//# sourceMappingURL=messageDeleted.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"messageDeleted.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/messageDeleted.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"messageDeleted.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/messageDeleted.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAK9B,wCAA+E;AAC/E,8CAAmB;AACnB,wFAA2F;AAG3F,MAAM,aAAa,GAAG,aAAC;KACpB,MAAM,CAAC;IACN,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;CACxB,CAAC;KACD,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;IAClB,OAAO;QACL,gBAAgB,EAAE,IAAI,CAAC,WAAW;KACnC,CAAA;AACH,CAAC,CAAC,CAAA;AAEJ,MAAM,UAAU,GAAG;IACjB,gBAAgB,EAAE;QAChB,GAAG,EAAE,kBAAkB;QACvB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,cAAc,GAIvB;IACF,GAAG,EAAE,gBAAgB;IACrB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;;QACrE,MAAM,EACJ,gBAAgB,EAAE,EAAE,gBAAgB,EAAE,EACtC,GAAG,GACJ,GAAG,MAAM,IAAA,gEAAkC,EAAC;YAC3C,aAAa;YACb,OAAO;YACP,QAAQ;SACT,CAAC,CAAA;QACF,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAA;QACtE,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,eAAe,CAAC,EAAE,EAAE,EAAE,MAAA,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI,0CAAE,IAAI,0CAAE,eAAe,EAAE,CAAC,CAAA;QAC5G,MAAM,iBAAiB,GAAG,MAAA,MAAA,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,0CAAE,YAAY,0CAAE,UAAU,CAAA;QAC9E,MAAM,SAAS,CAAC;YACd,WAAW,EAAE;gBACX,gBAAgB;aACjB;YACD,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,iBAAiB,CAAC,IAAI;gBAC/B,kBAAkB,EAAE;oBAClB,MAAM,EAAE,2BAAmB;oBAC3B,KAAK,EAAE,iBAAiB;iBACzB;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { type Webhook } from '@awell-health/extensions-core';
|
2
2
|
import { type HealthieWebhookPayload } from '../lib/types';
|
3
|
+
import { type settings } from '../settings';
|
3
4
|
declare const dataPoints: {
|
4
5
|
createdMetricId: {
|
5
6
|
key: string;
|
6
7
|
valueType: "string";
|
7
8
|
};
|
8
9
|
};
|
9
|
-
export declare const metricEntryCreated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload>;
|
10
|
+
export declare const metricEntryCreated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload, typeof settings>;
|
10
11
|
export type MetricEntryCreated = typeof metricEntryCreated;
|
11
12
|
export {};
|
@@ -1,7 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.metricEntryCreated = void 0;
|
4
7
|
const lodash_1 = require("lodash");
|
8
|
+
const types_1 = require("../lib/types");
|
9
|
+
const zod_1 = __importDefault(require("zod"));
|
10
|
+
const validatePayloadAndCreateSdk_1 = require("../lib/sdk/validatePayloadAndCreateSdk");
|
11
|
+
const payloadSchema = zod_1.default
|
12
|
+
.object({
|
13
|
+
resource_id: zod_1.default.string(),
|
14
|
+
})
|
15
|
+
.transform((data) => {
|
16
|
+
return {
|
17
|
+
createdMetricId: data.resource_id,
|
18
|
+
};
|
19
|
+
});
|
5
20
|
const dataPoints = {
|
6
21
|
createdMetricId: {
|
7
22
|
key: 'createdMetricId',
|
@@ -12,19 +27,25 @@ exports.metricEntryCreated = {
|
|
12
27
|
key: 'metricEntryCreated',
|
13
28
|
dataPoints,
|
14
29
|
onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
30
|
+
var _a, _b, _c;
|
31
|
+
const { validatedPayload: { createdMetricId }, sdk, } = await (0, validatePayloadAndCreateSdk_1.validateWebhookPayloadAndCreateSdk)({
|
32
|
+
payloadSchema,
|
33
|
+
payload,
|
34
|
+
settings,
|
35
|
+
});
|
36
|
+
const response = await sdk.getMetricEntry({ id: createdMetricId });
|
37
|
+
const healthiePatientId = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.entry) === null || _b === void 0 ? void 0 : _b.poster) === null || _c === void 0 ? void 0 : _c.id;
|
38
|
+
await onSuccess({
|
39
|
+
data_points: {
|
40
|
+
createdMetricId,
|
41
|
+
},
|
42
|
+
...(!(0, lodash_1.isNil)(healthiePatientId) && {
|
43
|
+
patient_identifier: {
|
44
|
+
system: types_1.HEALTHIE_IDENTIFIER,
|
45
|
+
value: healthiePatientId,
|
25
46
|
},
|
26
|
-
})
|
27
|
-
}
|
47
|
+
}),
|
48
|
+
});
|
28
49
|
},
|
29
50
|
};
|
30
51
|
//# sourceMappingURL=metricEntryCreated.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"metricEntryCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/metricEntryCreated.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"metricEntryCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/metricEntryCreated.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAK9B,wCAA+E;AAC/E,8CAAmB;AACnB,wFAA2F;AAG3F,MAAM,aAAa,GAAG,aAAC;KACpB,MAAM,CAAC;IACN,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;CACxB,CAAC;KACD,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;IAClB,OAAO;QACL,eAAe,EAAE,IAAI,CAAC,WAAW;KAClC,CAAA;AACH,CAAC,CAAC,CAAA;AAEJ,MAAM,UAAU,GAAG;IACjB,eAAe,EAAE;QACf,GAAG,EAAE,iBAAiB;QACtB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,kBAAkB,GAI3B;IACF,GAAG,EAAE,oBAAoB;IACzB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;;QACrE,MAAM,EACJ,gBAAgB,EAAE,EAAE,eAAe,EAAE,EACrC,GAAG,GACJ,GAAG,MAAM,IAAA,gEAAkC,EAAC;YAC3C,aAAa;YACb,OAAO;YACP,QAAQ;SACT,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,CAAA;QAClE,MAAM,iBAAiB,GAAG,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,KAAK,0CAAE,MAAM,0CAAE,EAAE,CAAA;QAC3D,MAAM,SAAS,CAAC;YACd,WAAW,EAAE;gBACX,eAAe;aAChB;YACD,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,iBAAiB,CAAC,IAAI;gBAC/B,kBAAkB,EAAE;oBAClB,MAAM,EAAE,2BAAmB;oBAC3B,KAAK,EAAE,iBAAiB;iBACzB;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { type Webhook } from '@awell-health/extensions-core';
|
2
2
|
import { type HealthieWebhookPayload } from '../lib/types';
|
3
|
+
import { type settings } from '../settings';
|
3
4
|
declare const dataPoints: {
|
4
5
|
updatedMetricId: {
|
5
6
|
key: string;
|
6
7
|
valueType: "string";
|
7
8
|
};
|
8
9
|
};
|
9
|
-
export declare const metricEntryUpdated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload>;
|
10
|
+
export declare const metricEntryUpdated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload, typeof settings>;
|
10
11
|
export type MetricEntryUpdated = typeof metricEntryUpdated;
|
11
12
|
export {};
|
@@ -1,7 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.metricEntryUpdated = void 0;
|
4
7
|
const lodash_1 = require("lodash");
|
8
|
+
const types_1 = require("../lib/types");
|
9
|
+
const zod_1 = __importDefault(require("zod"));
|
10
|
+
const validatePayloadAndCreateSdk_1 = require("../lib/sdk/validatePayloadAndCreateSdk");
|
11
|
+
const payloadSchema = zod_1.default
|
12
|
+
.object({
|
13
|
+
resource_id: zod_1.default.string(),
|
14
|
+
})
|
15
|
+
.transform((data) => {
|
16
|
+
return {
|
17
|
+
updatedMetricId: data.resource_id,
|
18
|
+
};
|
19
|
+
});
|
5
20
|
const dataPoints = {
|
6
21
|
updatedMetricId: {
|
7
22
|
key: 'updatedMetricId',
|
@@ -12,19 +27,25 @@ exports.metricEntryUpdated = {
|
|
12
27
|
key: 'metricEntryUpdated',
|
13
28
|
dataPoints,
|
14
29
|
onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
30
|
+
var _a, _b, _c;
|
31
|
+
const { validatedPayload: { updatedMetricId }, sdk, } = await (0, validatePayloadAndCreateSdk_1.validateWebhookPayloadAndCreateSdk)({
|
32
|
+
payloadSchema,
|
33
|
+
payload,
|
34
|
+
settings,
|
35
|
+
});
|
36
|
+
const response = await sdk.getMetricEntry({ id: updatedMetricId });
|
37
|
+
const healthiePatientId = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.entry) === null || _b === void 0 ? void 0 : _b.poster) === null || _c === void 0 ? void 0 : _c.id;
|
38
|
+
await onSuccess({
|
39
|
+
data_points: {
|
40
|
+
updatedMetricId,
|
41
|
+
},
|
42
|
+
...(!(0, lodash_1.isNil)(healthiePatientId) && {
|
43
|
+
patient_identifier: {
|
44
|
+
system: types_1.HEALTHIE_IDENTIFIER,
|
45
|
+
value: healthiePatientId,
|
25
46
|
},
|
26
|
-
})
|
27
|
-
}
|
47
|
+
}),
|
48
|
+
});
|
28
49
|
},
|
29
50
|
};
|
30
51
|
//# sourceMappingURL=metricEntryUpdated.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"metricEntryUpdated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/metricEntryUpdated.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"metricEntryUpdated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/metricEntryUpdated.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAK9B,wCAA+E;AAC/E,8CAAmB;AACnB,wFAA2F;AAG3F,MAAM,aAAa,GAAG,aAAC;KACpB,MAAM,CAAC;IACN,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;CACxB,CAAC;KACD,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;IAClB,OAAO;QACL,eAAe,EAAE,IAAI,CAAC,WAAW;KAClC,CAAA;AACH,CAAC,CAAC,CAAA;AAEJ,MAAM,UAAU,GAAG;IACjB,eAAe,EAAE;QACf,GAAG,EAAE,iBAAiB;QACtB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,kBAAkB,GAI3B;IACF,GAAG,EAAE,oBAAoB;IACzB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;;QACrE,MAAM,EACJ,gBAAgB,EAAE,EAAE,eAAe,EAAE,EACrC,GAAG,GACJ,GAAG,MAAM,IAAA,gEAAkC,EAAC;YAC3C,aAAa;YACb,OAAO;YACP,QAAQ;SACT,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,CAAA;QAClE,MAAM,iBAAiB,GAAG,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,KAAK,0CAAE,MAAM,0CAAE,EAAE,CAAA;QAE3D,MAAM,SAAS,CAAC;YACd,WAAW,EAAE;gBACX,eAAe;aAChB;YACD,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,iBAAiB,CAAC,IAAI;gBAC/B,kBAAkB,EAAE;oBAClB,MAAM,EAAE,2BAAmB;oBAC3B,KAAK,EAAE,iBAAiB;iBACzB;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.patientCreated = void 0;
|
4
4
|
const lodash_1 = require("lodash");
|
5
|
+
const types_1 = require("../lib/types");
|
5
6
|
const dataPoints = {
|
6
7
|
patientId: {
|
7
8
|
key: 'patientId',
|
@@ -23,6 +24,10 @@ exports.patientCreated = {
|
|
23
24
|
data_points: {
|
24
25
|
patientId,
|
25
26
|
},
|
27
|
+
patient_identifier: {
|
28
|
+
system: types_1.HEALTHIE_IDENTIFIER,
|
29
|
+
value: patientId,
|
30
|
+
},
|
26
31
|
});
|
27
32
|
}
|
28
33
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"patientCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/patientCreated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;
|
1
|
+
{"version":3,"file":"patientCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/patientCreated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAK9B,wCAA+E;AAE/E,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,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACrE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;QAE1C,IAAI,IAAA,cAAK,EAAC,SAAS,CAAC,EAAE;YACpB,MAAM,OAAO,CAAC;YACZ,sEAAsE;aACvE,CAAC,CAAA;SACH;aAAM;YACL,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACX,SAAS;iBACV;gBACD,kBAAkB,EAAE;oBAClB,MAAM,EAAE,2BAAmB;oBAC3B,KAAK,EAAE,SAAS;iBACjB;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF,CAAA"}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.patientUpdated = void 0;
|
4
4
|
const lodash_1 = require("lodash");
|
5
|
+
const types_1 = require("../lib/types");
|
5
6
|
const dataPoints = {
|
6
7
|
updatedPatientId: {
|
7
8
|
key: 'updatedPatientId',
|
@@ -23,6 +24,10 @@ exports.patientUpdated = {
|
|
23
24
|
data_points: {
|
24
25
|
updatedPatientId,
|
25
26
|
},
|
27
|
+
patient_identifier: {
|
28
|
+
system: types_1.HEALTHIE_IDENTIFIER,
|
29
|
+
value: updatedPatientId,
|
30
|
+
},
|
26
31
|
});
|
27
32
|
}
|
28
33
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"patientUpdated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/patientUpdated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;
|
1
|
+
{"version":3,"file":"patientUpdated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/patientUpdated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAK9B,wCAA+E;AAE/E,MAAM,UAAU,GAAG;IACjB,gBAAgB,EAAE;QAChB,GAAG,EAAE,kBAAkB;QACvB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,cAAc,GAGvB;IACF,GAAG,EAAE,gBAAgB;IACrB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACrE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAA;QAEjD,IAAI,IAAA,cAAK,EAAC,gBAAgB,CAAC,EAAE;YAC3B,MAAM,OAAO,CAAC;YACZ,sEAAsE;aACvE,CAAC,CAAA;SACH;aAAM;YACL,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACX,gBAAgB;iBACjB;gBACD,kBAAkB,EAAE;oBAClB,MAAM,EAAE,2BAAmB;oBAC3B,KAAK,EAAE,gBAAgB;iBACxB;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF,CAAA"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { type Webhook } from '@awell-health/extensions-core';
|
2
2
|
import { type HealthieWebhookPayload } from '../lib/types';
|
3
|
+
import { type settings } from '../settings';
|
3
4
|
declare const dataPoints: {
|
4
5
|
createdFormCompletionId: {
|
5
6
|
key: string;
|
6
7
|
valueType: "string";
|
7
8
|
};
|
8
9
|
};
|
9
|
-
export declare const requestFormCompletionCreated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload>;
|
10
|
+
export declare const requestFormCompletionCreated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload, typeof settings>;
|
10
11
|
export type RequestFormCompletionCreated = typeof requestFormCompletionCreated;
|
11
12
|
export {};
|
@@ -1,7 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.requestFormCompletionCreated = void 0;
|
4
7
|
const lodash_1 = require("lodash");
|
8
|
+
const types_1 = require("../lib/types");
|
9
|
+
const zod_1 = __importDefault(require("zod"));
|
10
|
+
const validatePayloadAndCreateSdk_1 = require("../lib/sdk/validatePayloadAndCreateSdk");
|
11
|
+
const payloadSchema = zod_1.default
|
12
|
+
.object({
|
13
|
+
resource_id: zod_1.default.string(),
|
14
|
+
})
|
15
|
+
.transform((data) => {
|
16
|
+
return {
|
17
|
+
createdFormCompletionId: data.resource_id,
|
18
|
+
};
|
19
|
+
});
|
5
20
|
const dataPoints = {
|
6
21
|
createdFormCompletionId: {
|
7
22
|
key: 'createdFormCompletionId',
|
@@ -12,19 +27,25 @@ exports.requestFormCompletionCreated = {
|
|
12
27
|
key: 'requestFormCompletionCreated',
|
13
28
|
dataPoints,
|
14
29
|
onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
30
|
+
var _a, _b;
|
31
|
+
const { validatedPayload: { createdFormCompletionId }, sdk, } = await (0, validatePayloadAndCreateSdk_1.validateWebhookPayloadAndCreateSdk)({
|
32
|
+
payloadSchema,
|
33
|
+
payload,
|
34
|
+
settings,
|
35
|
+
});
|
36
|
+
const response = await sdk.getRequestedFormCompletion({ id: createdFormCompletionId });
|
37
|
+
const healthiePatientId = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.requestedFormCompletion) === null || _b === void 0 ? void 0 : _b.recipient_id;
|
38
|
+
await onSuccess({
|
39
|
+
data_points: {
|
40
|
+
createdFormCompletionId,
|
41
|
+
},
|
42
|
+
...(!(0, lodash_1.isNil)(healthiePatientId) && {
|
43
|
+
patient_identifier: {
|
44
|
+
system: types_1.HEALTHIE_IDENTIFIER,
|
45
|
+
value: healthiePatientId,
|
25
46
|
},
|
26
|
-
})
|
27
|
-
}
|
47
|
+
}),
|
48
|
+
});
|
28
49
|
},
|
29
50
|
};
|
30
51
|
//# sourceMappingURL=requestedFormCompletionCreated.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"requestedFormCompletionCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/requestedFormCompletionCreated.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"requestedFormCompletionCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/requestedFormCompletionCreated.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAK9B,wCAA+E;AAC/E,8CAAmB;AACnB,wFAA2F;AAG3F,MAAM,aAAa,GAAG,aAAC;KACpB,MAAM,CAAC;IACN,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;CACxB,CAAC;KACD,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;IAClB,OAAO;QACL,uBAAuB,EAAE,IAAI,CAAC,WAAW;KAC1C,CAAA;AACH,CAAC,CAAC,CAAA;AAEJ,MAAM,UAAU,GAAG;IACjB,uBAAuB,EAAE;QACvB,GAAG,EAAE,yBAAyB;QAC9B,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,4BAA4B,GAIrC;IACF,GAAG,EAAE,8BAA8B;IACnC,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;;QACrE,MAAM,EACJ,gBAAgB,EAAE,EAAE,uBAAuB,EAAE,EAC7C,GAAG,GACJ,GAAG,MAAM,IAAA,gEAAkC,EAAC;YAC3C,aAAa;YACb,OAAO;YACP,QAAQ;SACT,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,0BAA0B,CAAC,EAAE,EAAE,EAAE,uBAAuB,EAAE,CAAC,CAAA;QACtF,MAAM,iBAAiB,GAAG,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,uBAAuB,0CAAE,YAAY,CAAA;QAC/E,MAAM,SAAS,CAAC;YACd,WAAW,EAAE;gBACX,uBAAuB;aACxB;YACD,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,iBAAiB,CAAC,IAAI;gBAC/B,kBAAkB,EAAE;oBAClB,MAAM,EAAE,2BAAmB;oBAC3B,KAAK,EAAE,iBAAiB;iBACzB;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { type Webhook } from '@awell-health/extensions-core';
|
2
2
|
import { type HealthieWebhookPayload } from '../lib/types';
|
3
|
+
import { type settings } from '../settings';
|
3
4
|
declare const dataPoints: {
|
4
5
|
updatedFormCompletionId: {
|
5
6
|
key: string;
|
6
7
|
valueType: "string";
|
7
8
|
};
|
8
9
|
};
|
9
|
-
export declare const requestFormCompletionUpdated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload>;
|
10
|
+
export declare const requestFormCompletionUpdated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload, typeof settings>;
|
10
11
|
export type RequestFormCompletionUpdated = typeof requestFormCompletionUpdated;
|
11
12
|
export {};
|
@@ -1,7 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.requestFormCompletionUpdated = void 0;
|
4
7
|
const lodash_1 = require("lodash");
|
8
|
+
const types_1 = require("../lib/types");
|
9
|
+
const zod_1 = __importDefault(require("zod"));
|
10
|
+
const validatePayloadAndCreateSdk_1 = require("../lib/sdk/validatePayloadAndCreateSdk");
|
11
|
+
const payloadSchema = zod_1.default
|
12
|
+
.object({
|
13
|
+
resource_id: zod_1.default.string(),
|
14
|
+
})
|
15
|
+
.transform((data) => {
|
16
|
+
return {
|
17
|
+
updatedFormCompletionId: data.resource_id,
|
18
|
+
};
|
19
|
+
});
|
5
20
|
const dataPoints = {
|
6
21
|
updatedFormCompletionId: {
|
7
22
|
key: 'updatedFormCompletionId',
|
@@ -12,19 +27,25 @@ exports.requestFormCompletionUpdated = {
|
|
12
27
|
key: 'requestFormCompletionUpdated',
|
13
28
|
dataPoints,
|
14
29
|
onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
30
|
+
var _a, _b;
|
31
|
+
const { validatedPayload: { updatedFormCompletionId }, sdk, } = await (0, validatePayloadAndCreateSdk_1.validateWebhookPayloadAndCreateSdk)({
|
32
|
+
payloadSchema,
|
33
|
+
payload,
|
34
|
+
settings,
|
35
|
+
});
|
36
|
+
const response = await sdk.getRequestedFormCompletion({ id: updatedFormCompletionId });
|
37
|
+
const healthiePatientId = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.requestedFormCompletion) === null || _b === void 0 ? void 0 : _b.recipient_id;
|
38
|
+
await onSuccess({
|
39
|
+
data_points: {
|
40
|
+
updatedFormCompletionId,
|
41
|
+
},
|
42
|
+
...(!(0, lodash_1.isNil)(healthiePatientId) && {
|
43
|
+
patient_identifier: {
|
44
|
+
system: types_1.HEALTHIE_IDENTIFIER,
|
45
|
+
value: healthiePatientId,
|
25
46
|
},
|
26
|
-
})
|
27
|
-
}
|
47
|
+
}),
|
48
|
+
});
|
28
49
|
},
|
29
50
|
};
|
30
51
|
//# sourceMappingURL=requestedFormCompletionUpdated.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"requestedFormCompletionUpdated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/requestedFormCompletionUpdated.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"requestedFormCompletionUpdated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/requestedFormCompletionUpdated.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAK9B,wCAA+E;AAC/E,8CAAmB;AACnB,wFAA2F;AAG3F,MAAM,aAAa,GAAG,aAAC;KACpB,MAAM,CAAC;IACN,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;CACxB,CAAC;KACD,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;IAClB,OAAO;QACL,uBAAuB,EAAE,IAAI,CAAC,WAAW;KAC1C,CAAA;AACH,CAAC,CAAC,CAAA;AAEJ,MAAM,UAAU,GAAG;IACjB,uBAAuB,EAAE;QACvB,GAAG,EAAE,yBAAyB;QAC9B,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,4BAA4B,GAIrC;IACF,GAAG,EAAE,8BAA8B;IACnC,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;;QACrE,MAAM,EACJ,gBAAgB,EAAE,EAAE,uBAAuB,EAAE,EAC7C,GAAG,GACJ,GAAG,MAAM,IAAA,gEAAkC,EAAC;YAC3C,aAAa;YACb,OAAO;YACP,QAAQ;SACT,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,0BAA0B,CAAC,EAAE,EAAE,EAAE,uBAAuB,EAAE,CAAC,CAAA;QACtF,MAAM,iBAAiB,GAAG,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,uBAAuB,0CAAE,YAAY,CAAA;QAC/E,MAAM,SAAS,CAAC;YACd,WAAW,EAAE;gBACX,uBAAuB;aACxB;YACD,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,iBAAiB,CAAC,IAAI;gBAC/B,kBAAkB,EAAE;oBAClB,MAAM,EAAE,2BAAmB;oBAC3B,KAAK,EAAE,iBAAiB;iBACzB;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { type Webhook } from '@awell-health/extensions-core';
|
2
2
|
import { type HealthieWebhookPayload } from '../lib/types';
|
3
|
+
import { type settings } from '../settings';
|
3
4
|
declare const dataPoints: {
|
4
5
|
createdTaskId: {
|
5
6
|
key: string;
|
6
7
|
valueType: "string";
|
7
8
|
};
|
8
9
|
};
|
9
|
-
export declare const taskCreated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload>;
|
10
|
+
export declare const taskCreated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload, typeof settings>;
|
10
11
|
export type TaskCreated = typeof taskCreated;
|
11
12
|
export {};
|
@@ -1,7 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.taskCreated = void 0;
|
4
7
|
const lodash_1 = require("lodash");
|
8
|
+
const types_1 = require("../lib/types");
|
9
|
+
const zod_1 = __importDefault(require("zod"));
|
10
|
+
const validatePayloadAndCreateSdk_1 = require("../lib/sdk/validatePayloadAndCreateSdk");
|
11
|
+
const payloadSchema = zod_1.default
|
12
|
+
.object({
|
13
|
+
resource_id: zod_1.default.string(),
|
14
|
+
})
|
15
|
+
.transform((data) => {
|
16
|
+
return {
|
17
|
+
createdTaskId: data.resource_id,
|
18
|
+
};
|
19
|
+
});
|
5
20
|
const dataPoints = {
|
6
21
|
createdTaskId: {
|
7
22
|
key: 'createdTaskId',
|
@@ -12,19 +27,25 @@ exports.taskCreated = {
|
|
12
27
|
key: 'taskCreated',
|
13
28
|
dataPoints,
|
14
29
|
onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
30
|
+
var _a, _b;
|
31
|
+
const { validatedPayload: { createdTaskId }, sdk, } = await (0, validatePayloadAndCreateSdk_1.validateWebhookPayloadAndCreateSdk)({
|
32
|
+
payloadSchema,
|
33
|
+
payload,
|
34
|
+
settings,
|
35
|
+
});
|
36
|
+
const response = await sdk.getTask({ id: createdTaskId });
|
37
|
+
const healthiePatientId = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.task) === null || _b === void 0 ? void 0 : _b.client_id;
|
38
|
+
await onSuccess({
|
39
|
+
data_points: {
|
40
|
+
createdTaskId,
|
41
|
+
},
|
42
|
+
...(!(0, lodash_1.isNil)(healthiePatientId) && {
|
43
|
+
patient_identifier: {
|
44
|
+
system: types_1.HEALTHIE_IDENTIFIER,
|
45
|
+
value: healthiePatientId,
|
25
46
|
},
|
26
|
-
})
|
27
|
-
}
|
47
|
+
}),
|
48
|
+
});
|
28
49
|
},
|
29
50
|
};
|
30
51
|
//# sourceMappingURL=taskCreated.js.map
|