@awell-health/awell-extensions 1.0.49 → 1.0.51
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/healthie/actions/assignPatientToGroup.d.ts +20 -0
- package/dist/extensions/healthie/actions/assignPatientToGroup.js +104 -0
- package/dist/extensions/healthie/actions/assignPatientToGroup.js.map +1 -0
- package/dist/extensions/healthie/actions/index.d.ts +36 -11
- package/dist/extensions/healthie/actions/index.js +5 -3
- package/dist/extensions/healthie/actions/index.js.map +1 -1
- package/package.json +1 -1
@@ -0,0 +1,20 @@
|
|
1
|
+
import { FieldType, type Action } from '@awell-health/extensions-core';
|
2
|
+
import { type settings } from '../settings';
|
3
|
+
declare const fields: {
|
4
|
+
id: {
|
5
|
+
id: string;
|
6
|
+
label: string;
|
7
|
+
description: string;
|
8
|
+
type: FieldType.STRING;
|
9
|
+
required: true;
|
10
|
+
};
|
11
|
+
groupId: {
|
12
|
+
id: string;
|
13
|
+
label: string;
|
14
|
+
description: string;
|
15
|
+
type: FieldType.STRING;
|
16
|
+
required: false;
|
17
|
+
};
|
18
|
+
};
|
19
|
+
export declare const assignPatientToGroup: Action<typeof fields, typeof settings>;
|
20
|
+
export {};
|
@@ -0,0 +1,104 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.assignPatientToGroup = void 0;
|
4
|
+
const lodash_1 = require("lodash");
|
5
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
6
|
+
const extensions_core_2 = require("@awell-health/extensions-core");
|
7
|
+
const sdk_1 = require("../gql/sdk");
|
8
|
+
const graphqlClient_1 = require("../graphqlClient");
|
9
|
+
const errors_1 = require("../errors");
|
10
|
+
const fields = {
|
11
|
+
id: {
|
12
|
+
id: 'id',
|
13
|
+
label: 'Patient ID',
|
14
|
+
description: 'The id of the patient in Healthie.',
|
15
|
+
type: extensions_core_1.FieldType.STRING,
|
16
|
+
required: true,
|
17
|
+
},
|
18
|
+
groupId: {
|
19
|
+
id: 'groupId',
|
20
|
+
label: 'Group ID',
|
21
|
+
description: 'The ID of the group the patient will be assigned to. Leave blank to remove the patient from a group.',
|
22
|
+
type: extensions_core_1.FieldType.STRING,
|
23
|
+
required: false,
|
24
|
+
},
|
25
|
+
};
|
26
|
+
exports.assignPatientToGroup = {
|
27
|
+
key: 'assignPatientToGroup',
|
28
|
+
category: extensions_core_2.Category.EHR_INTEGRATIONS,
|
29
|
+
title: 'Assign patient to group',
|
30
|
+
description: 'Assign or remove a patient from a group in Healthie.',
|
31
|
+
fields,
|
32
|
+
previewable: true,
|
33
|
+
onActivityCreated: async (payload, onComplete, onError) => {
|
34
|
+
const { fields, settings } = payload;
|
35
|
+
const { id, groupId } = fields;
|
36
|
+
try {
|
37
|
+
if ((0, lodash_1.isNil)(id)) {
|
38
|
+
await onError({
|
39
|
+
events: [
|
40
|
+
{
|
41
|
+
date: new Date().toISOString(),
|
42
|
+
text: { en: 'Fields are missing' },
|
43
|
+
error: {
|
44
|
+
category: 'MISSING_FIELDS',
|
45
|
+
message: '`id` is missing',
|
46
|
+
},
|
47
|
+
},
|
48
|
+
],
|
49
|
+
});
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
const client = (0, graphqlClient_1.initialiseClient)(settings);
|
53
|
+
if (client !== undefined) {
|
54
|
+
const sdk = (0, sdk_1.getSdk)(client);
|
55
|
+
await sdk.updatePatient({
|
56
|
+
input: {
|
57
|
+
id,
|
58
|
+
// "" group will remove from current group according to docs
|
59
|
+
user_group_id: groupId !== null && groupId !== void 0 ? groupId : '',
|
60
|
+
},
|
61
|
+
});
|
62
|
+
await onComplete();
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
await onError({
|
66
|
+
events: [
|
67
|
+
{
|
68
|
+
date: new Date().toISOString(),
|
69
|
+
text: { en: 'API client requires an API url and API key' },
|
70
|
+
error: {
|
71
|
+
category: 'MISSING_SETTINGS',
|
72
|
+
message: 'Missing api url or api key',
|
73
|
+
},
|
74
|
+
},
|
75
|
+
],
|
76
|
+
});
|
77
|
+
}
|
78
|
+
}
|
79
|
+
catch (err) {
|
80
|
+
if (err instanceof errors_1.HealthieError) {
|
81
|
+
const errors = (0, errors_1.mapHealthieToActivityError)(err.errors);
|
82
|
+
await onError({
|
83
|
+
events: errors,
|
84
|
+
});
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
const error = err;
|
88
|
+
await onError({
|
89
|
+
events: [
|
90
|
+
{
|
91
|
+
date: new Date().toISOString(),
|
92
|
+
text: { en: 'Healthie API reported an error' },
|
93
|
+
error: {
|
94
|
+
category: 'SERVER_ERROR',
|
95
|
+
message: error.message,
|
96
|
+
},
|
97
|
+
},
|
98
|
+
],
|
99
|
+
});
|
100
|
+
}
|
101
|
+
}
|
102
|
+
},
|
103
|
+
};
|
104
|
+
//# sourceMappingURL=assignPatientToGroup.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"assignPatientToGroup.js","sourceRoot":"","sources":["../../../../extensions/healthie/actions/assignPatientToGroup.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,mEAIsC;AACtC,mEAAwD;AACxD,oCAAmC;AACnC,oDAAmD;AAEnD,sCAAqE;AAErE,MAAM,MAAM,GAAG;IACb,EAAE,EAAE;QACF,EAAE,EAAE,IAAI;QACR,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,oCAAoC;QACjD,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,UAAU;QACjB,WAAW,EACT,sGAAsG;QACxG,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,oBAAoB,GAA2C;IAC1E,GAAG,EAAE,sBAAsB;IAC3B,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,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6BACtC;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,YAAY,sBAAa,EAAE;gBAChC,MAAM,MAAM,GAAG,IAAA,mCAA0B,EAAC,GAAG,CAAC,MAAM,CAAC,CAAA;gBACrD,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,MAAM;iBACf,CAAC,CAAA;aACH;iBAAM;gBACL,MAAM,KAAK,GAAG,GAAY,CAAA;gBAC1B,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,gCAAgC,EAAE;4BAC9C,KAAK,EAAE;gCACL,QAAQ,EAAE,cAAc;gCACxB,OAAO,EAAE,KAAK,CAAC,OAAO;6BACvB;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;SACF;IACH,CAAC;CACF,CAAA"}
|
@@ -32,10 +32,7 @@ export declare const actions: {
|
|
32
32
|
label: string;
|
33
33
|
description: string;
|
34
34
|
type: import("@awell-health/extensions-core").FieldType.STRING;
|
35
|
-
required: true;
|
36
|
-
* Specs of this API endpoint are unclear so we are not sure what
|
37
|
-
* functional value it delivers in the current state. Needs to be revisited.
|
38
|
-
**/
|
35
|
+
required: true;
|
39
36
|
};
|
40
37
|
}, {
|
41
38
|
apiUrl: {
|
@@ -314,10 +311,7 @@ export declare const actions: {
|
|
314
311
|
};
|
315
312
|
email: {
|
316
313
|
id: string;
|
317
|
-
label: string;
|
318
|
-
* There is bug in Healthie that prevents linking an address with a patient
|
319
|
-
* Waiting for fix
|
320
|
-
**/
|
314
|
+
label: string;
|
321
315
|
description: string;
|
322
316
|
type: import("@awell-health/extensions-core").FieldType.STRING;
|
323
317
|
stringType: import("@awell-health/extensions-core").StringType.EMAIL;
|
@@ -549,9 +543,9 @@ export declare const actions: {
|
|
549
543
|
};
|
550
544
|
}, string>;
|
551
545
|
/**
|
552
|
-
|
553
|
-
|
554
|
-
|
546
|
+
* There is bug in Healthie that prevents linking an address with a patient
|
547
|
+
* Waiting for fix
|
548
|
+
**/
|
555
549
|
closeChatConversation: import("@awell-health/extensions-core").Action<{
|
556
550
|
id: {
|
557
551
|
id: string;
|
@@ -683,4 +677,35 @@ export declare const actions: {
|
|
683
677
|
description: string;
|
684
678
|
};
|
685
679
|
}, string>;
|
680
|
+
assignPatientToGroup: import("@awell-health/extensions-core").Action<{
|
681
|
+
id: {
|
682
|
+
id: string;
|
683
|
+
label: string;
|
684
|
+
description: string;
|
685
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
686
|
+
required: true;
|
687
|
+
};
|
688
|
+
groupId: {
|
689
|
+
id: string;
|
690
|
+
label: string;
|
691
|
+
description: string;
|
692
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
693
|
+
required: false;
|
694
|
+
};
|
695
|
+
}, {
|
696
|
+
apiUrl: {
|
697
|
+
key: string;
|
698
|
+
label: string;
|
699
|
+
obfuscated: false;
|
700
|
+
required: true;
|
701
|
+
description: string;
|
702
|
+
};
|
703
|
+
apiKey: {
|
704
|
+
key: string;
|
705
|
+
label: string;
|
706
|
+
obfuscated: true;
|
707
|
+
required: true;
|
708
|
+
description: string;
|
709
|
+
};
|
710
|
+
}, string>;
|
686
711
|
};
|
@@ -19,6 +19,7 @@ const deleteAppointment_1 = require("./deleteAppointment");
|
|
19
19
|
const cancelAppointment_1 = require("./cancelAppointment");
|
20
20
|
const deleteTask_1 = require("./deleteTask");
|
21
21
|
const completeTask_1 = require("./completeTask");
|
22
|
+
const assignPatientToGroup_1 = require("./assignPatientToGroup");
|
22
23
|
exports.actions = {
|
23
24
|
createAppointment: createAppointment_1.createAppointment,
|
24
25
|
createTask: createTask_1.createTask,
|
@@ -33,9 +34,9 @@ exports.actions = {
|
|
33
34
|
sendFormCompletionRequest: sendFormCompletionRequest_1.sendFormCompletionRequest,
|
34
35
|
archivePatient: archivePatient_1.archivePatient,
|
35
36
|
/**
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
* There is bug in Healthie that prevents linking an address with a patient
|
38
|
+
* Waiting for fix
|
39
|
+
**/
|
39
40
|
// createLocation,
|
40
41
|
closeChatConversation: closeChatConversation_1.closeChatConversation,
|
41
42
|
deleteAppointment: deleteAppointment_1.deleteAppointment,
|
@@ -47,5 +48,6 @@ exports.actions = {
|
|
47
48
|
// createJournalEntry,
|
48
49
|
deleteTask: deleteTask_1.deleteTask,
|
49
50
|
completeTask: completeTask_1.completeTask,
|
51
|
+
assignPatientToGroup: assignPatientToGroup_1.assignPatientToGroup,
|
50
52
|
};
|
51
53
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/healthie/actions/index.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AACvD,6CAAyC;AACzC,qDAAiD;AACjD,6CAAyC;AACzC,uDAAmD;AACnD,mDAA+C;AAC/C,mDAA+C;AAC/C,2DAAuD;AACvD,iEAA6D;AAC7D,6DAAyD;AACzD,2EAAuE;AACvE,qDAAiD;AACjD,oDAAoD;AACpD,mEAA+D;AAC/D,2DAAuD;AACvD,2DAAuD;AACvD,6CAAyC;AACzC,iDAA6C;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/healthie/actions/index.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AACvD,6CAAyC;AACzC,qDAAiD;AACjD,6CAAyC;AACzC,uDAAmD;AACnD,mDAA+C;AAC/C,mDAA+C;AAC/C,2DAAuD;AACvD,iEAA6D;AAC7D,6DAAyD;AACzD,2EAAuE;AACvE,qDAAiD;AACjD,oDAAoD;AACpD,mEAA+D;AAC/D,2DAAuD;AACvD,2DAAuD;AACvD,6CAAyC;AACzC,iDAA6C;AAC7C,iEAA6D;AAEhD,QAAA,OAAO,GAAG;IACrB,iBAAiB,EAAjB,qCAAiB;IACjB,UAAU,EAAV,uBAAU;IACV,cAAc,EAAd,+BAAc;IACd,UAAU,EAAV,uBAAU;IACV,eAAe,EAAf,iCAAe;IACf,aAAa,EAAb,6BAAa;IACb,aAAa,EAAb,6BAAa;IACb,iBAAiB,EAAjB,qCAAiB;IACjB,oBAAoB,EAApB,2CAAoB;IACpB,kBAAkB,EAAlB,uCAAkB;IAClB,yBAAyB,EAAzB,qDAAyB;IACzB,cAAc,EAAd,+BAAc;IACd;;;QAGI;IACJ,kBAAkB;IAClB,qBAAqB,EAArB,6CAAqB;IACrB,iBAAiB,EAAjB,qCAAiB;IACjB,iBAAiB,EAAjB,qCAAiB;IACjB;;;QAGI;IACJ,sBAAsB;IACtB,UAAU,EAAV,uBAAU;IACV,YAAY,EAAZ,2BAAY;IACZ,oBAAoB,EAApB,2CAAoB;CACrB,CAAA"}
|