@awell-health/awell-extensions 2.0.49 → 2.0.51
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.js +51 -25
- package/dist/extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.js.map +1 -1
- package/dist/extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.test.js +357 -35
- package/dist/extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.test.js.map +1 -1
- package/dist/extensions/healthie/actions/createAppointment/config/fields.d.ts +20 -0
- package/dist/extensions/healthie/actions/createAppointment/config/fields.js +23 -0
- package/dist/extensions/healthie/actions/createAppointment/config/fields.js.map +1 -1
- package/dist/extensions/healthie/actions/createAppointment/createAppointment.js +50 -15
- package/dist/extensions/healthie/actions/createAppointment/createAppointment.js.map +1 -1
- package/dist/extensions/healthie/actions/createAppointment/createAppointment.test.js +58 -26
- package/dist/extensions/healthie/actions/createAppointment/createAppointment.test.js.map +1 -1
- package/dist/extensions/healthie/actions/createAppointment/lib/errors.d.ts +6 -0
- package/dist/extensions/healthie/actions/createAppointment/lib/errors.js +27 -0
- package/dist/extensions/healthie/actions/createAppointment/lib/errors.js.map +1 -0
- package/dist/extensions/healthie/actions/index.d.ts +14 -0
- package/dist/extensions/markdown.json +1 -1
- package/dist/extensions/zendesk/v1/actions/createTask/config/fields.d.ts +2 -2
- package/dist/extensions/zusHealth/webhooks/index.d.ts +1 -1
- package/dist/src/utils/getNextDateWithinBusinessHours/getNextDateWithinBusinessHours.test.js +2 -2
- package/dist/src/utils/getNextDateWithinBusinessHours/getNextDateWithinBusinessHours.test.js.map +1 -1
- package/package.json +1 -1
@@ -4,7 +4,6 @@ exports.addIdentifierToPatient = void 0;
|
|
4
4
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
5
|
const config_1 = require("./config");
|
6
6
|
const zod_1 = require("zod");
|
7
|
-
const lodash_1 = require("lodash");
|
8
7
|
exports.addIdentifierToPatient = {
|
9
8
|
key: 'addIdentifierToPatient',
|
10
9
|
category: extensions_core_1.Category.WORKFLOW,
|
@@ -23,47 +22,74 @@ exports.addIdentifierToPatient = {
|
|
23
22
|
payload,
|
24
23
|
});
|
25
24
|
const sdk = await helpers.awellSdk();
|
26
|
-
const patient = await sdk.orchestration.query({
|
25
|
+
const { patientByIdentifier: { patient: existingPatient }, } = await sdk.orchestration.query({
|
27
26
|
patientByIdentifier: {
|
28
|
-
__args: {
|
29
|
-
system,
|
30
|
-
value,
|
31
|
-
},
|
27
|
+
__args: { system, value },
|
32
28
|
patient: {
|
33
29
|
id: true,
|
30
|
+
profile: { identifier: { system: true, value: true } },
|
34
31
|
},
|
35
32
|
},
|
36
33
|
});
|
37
|
-
const
|
38
|
-
const isCurrentPatient =
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
34
|
+
const patientExists = Boolean(existingPatient === null || existingPatient === void 0 ? void 0 : existingPatient.id);
|
35
|
+
const isCurrentPatient = patientExists && (existingPatient === null || existingPatient === void 0 ? void 0 : existingPatient.id) === patientId;
|
36
|
+
if (patientExists && !isCurrentPatient) {
|
37
|
+
await onError({
|
38
|
+
events: [
|
39
|
+
{
|
40
|
+
date: new Date().toISOString(),
|
41
|
+
text: {
|
42
|
+
en: `Another patient (${String(existingPatient === null || existingPatient === void 0 ? void 0 : existingPatient.id)}) already has an identifier with system ${system} and value ${value}. Adding this identifier to the current patient is not possible.`,
|
43
|
+
},
|
44
|
+
},
|
45
|
+
],
|
46
|
+
});
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
// Filter identifiers, excluding any with the current system
|
50
|
+
const existingIdentifiers = (_b = (_a = existingPatient === null || existingPatient === void 0 ? void 0 : existingPatient.profile) === null || _a === void 0 ? void 0 : _a.identifier) !== null && _b !== void 0 ? _b : [];
|
51
|
+
const otherIdentifiers = existingIdentifiers.filter((id) => id.system !== system);
|
52
|
+
const previousIdentifier = existingIdentifiers.find((id) => id.system === system);
|
53
|
+
const isUpdatingIdentifier = Boolean(previousIdentifier);
|
54
|
+
if (isUpdatingIdentifier && (previousIdentifier === null || previousIdentifier === void 0 ? void 0 : previousIdentifier.value) === value) {
|
55
|
+
await onComplete({
|
56
|
+
events: [
|
57
|
+
{
|
58
|
+
date: new Date().toISOString(),
|
59
|
+
text: {
|
60
|
+
en: 'Patient already had an identifier of the same value and system. No changes were made.',
|
61
|
+
},
|
62
|
+
},
|
63
|
+
],
|
64
|
+
});
|
48
65
|
return;
|
49
66
|
}
|
67
|
+
// Perform update or add the new identifier
|
50
68
|
await sdk.orchestration.mutation({
|
51
|
-
|
69
|
+
updatePatient: {
|
52
70
|
__args: {
|
53
71
|
input: {
|
54
72
|
patient_id: patientId,
|
55
|
-
|
56
|
-
system,
|
57
|
-
value,
|
73
|
+
profile: {
|
74
|
+
identifier: [...otherIdentifiers, { system, value }],
|
58
75
|
},
|
59
76
|
},
|
60
77
|
},
|
61
|
-
patient: {
|
62
|
-
id: true,
|
63
|
-
},
|
78
|
+
patient: { id: true },
|
64
79
|
},
|
65
80
|
});
|
66
|
-
await onComplete(
|
81
|
+
await onComplete({
|
82
|
+
events: [
|
83
|
+
{
|
84
|
+
date: new Date().toISOString(),
|
85
|
+
text: {
|
86
|
+
en: isUpdatingIdentifier
|
87
|
+
? `The patient already had an identifier with system ${system} and value ${String(previousIdentifier === null || previousIdentifier === void 0 ? void 0 : previousIdentifier.value)}. The identifier value has been updated to ${value}.`
|
88
|
+
: `The identifier with system ${system} and value ${value} has been added to the patient.`,
|
89
|
+
},
|
90
|
+
},
|
91
|
+
],
|
92
|
+
});
|
67
93
|
},
|
68
94
|
};
|
69
95
|
//# sourceMappingURL=addIdentifierToPatient.js.map
|
package/dist/extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addIdentifierToPatient.js","sourceRoot":"","sources":["../../../../../../extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.ts"],"names":[],"mappings":";;;AAEA,mEAAkE;AAClE,qCAKiB;
|
1
|
+
{"version":3,"file":"addIdentifierToPatient.js","sourceRoot":"","sources":["../../../../../../extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.ts"],"names":[],"mappings":";;;AAEA,mEAAkE;AAClE,qCAKiB;AACjB,6BAAuB;AAEV,QAAA,sBAAsB,GAA2C;IAC5E,GAAG,EAAE,wBAAwB;IAC7B,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,KAAK,EAAE,2BAA2B;IAClC,WAAW,EAAE,+CAA+C;IAC5D,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;;QAC1E,MAAM,EACJ,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EACzB,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,GAC3B,GAAG,IAAA,0BAAQ,EAAC;YACX,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;gBACf,MAAM,EAAE,+BAAsB;gBAC9B,OAAO,EAAE,gCAAuB;aACjC,CAAC;YACF,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAA;QAEpC,MAAM,EACJ,mBAAmB,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,GAClD,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC;YAChC,mBAAmB,EAAE;gBACnB,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;gBACzB,OAAO,EAAE;oBACP,EAAE,EAAE,IAAI;oBACR,OAAO,EAAE,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAA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B,IAAI,EAAE;4BACJ,EAAE,EAAE,uFAAuF;yBAC5F;qBACF;iBACF;aACF,CAAC,CAAA;YACF,OAAM;SACP;QAED,2CAA2C;QAC3C,MAAM,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC;YAC/B,aAAa,EAAE;gBACb,MAAM,EAAE;oBACN,KAAK,EAAE;wBACL,UAAU,EAAE,SAAS;wBACrB,OAAO,EAAE;4BACP,UAAU,EAAE,CAAC,GAAG,gBAAgB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;yBACrD;qBACF;iBACF;gBACD,OAAO,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;aACtB;SACF,CAAC,CAAA;QAEF,MAAM,UAAU,CAAC;YACf,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;oBAC9B,IAAI,EAAE;wBACJ,EAAE,EAAE,oBAAoB;4BACtB,CAAC,CAAC,qDAAqD,MAAM,cAAc,MAAM,CAC7E,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,KAAK,CAC1B,8CAA8C,KAAK,GAAG;4BACzD,CAAC,CAAC,8BAA8B,MAAM,cAAc,KAAK,iCAAiC;qBAC7F;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
package/dist/extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.test.js
CHANGED
@@ -3,53 +3,375 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tests_1 = require("@/tests");
|
4
4
|
const addIdentifierToPatient_1 = require("./addIdentifierToPatient");
|
5
5
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
6
|
-
/**
|
7
|
-
* Test needs to be fixed
|
8
|
-
*/
|
9
6
|
jest.mock('@awell-health/awell-sdk');
|
10
7
|
describe('Add identifier to patient', () => {
|
11
|
-
const { onComplete, onError, extensionAction, clearMocks } = extensions_core_1.TestHelpers.fromAction(addIdentifierToPatient_1.addIdentifierToPatient);
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
8
|
+
const { onComplete, onError, extensionAction, helpers, clearMocks } = extensions_core_1.TestHelpers.fromAction(addIdentifierToPatient_1.addIdentifierToPatient);
|
9
|
+
beforeEach(() => {
|
10
|
+
clearMocks();
|
11
|
+
});
|
12
|
+
describe('No patient with the provided identifier system and value exists', () => {
|
13
|
+
describe('Current patient does already have an identifier of the same system but a different value', () => {
|
14
|
+
test('Should update the provided identifier system with the new identifier value', async () => {
|
15
|
+
/**
|
16
|
+
* Mocking the SDK's response to simulate a scenario where the current patient
|
17
|
+
* already has an identifier with the same system but a different value
|
18
|
+
*/
|
19
|
+
const awellSdkMock = {
|
20
|
+
orchestration: {
|
21
|
+
mutation: jest.fn().mockResolvedValue({}),
|
22
|
+
query: jest.fn().mockResolvedValue({
|
19
23
|
patientByIdentifier: {
|
20
24
|
patient: {
|
21
25
|
id: 'some-patient-id',
|
26
|
+
profile: {
|
27
|
+
identifier: [
|
28
|
+
{
|
29
|
+
system: 'https://www.system.com/',
|
30
|
+
value: 'existingIdentifierValue',
|
31
|
+
},
|
32
|
+
],
|
33
|
+
},
|
22
34
|
},
|
23
35
|
},
|
24
|
-
}
|
36
|
+
}),
|
37
|
+
},
|
38
|
+
};
|
39
|
+
helpers.awellSdk = jest.fn().mockResolvedValue(awellSdkMock);
|
40
|
+
// Simulate an event where a new identifier value is provided for an existing system
|
41
|
+
await extensionAction.onEvent({
|
42
|
+
payload: (0, tests_1.generateTestPayload)({
|
43
|
+
fields: {
|
44
|
+
system: 'https://www.system.com/',
|
45
|
+
value: 'identifier-value',
|
46
|
+
},
|
47
|
+
settings: {},
|
48
|
+
patient: {
|
49
|
+
id: 'some-patient-id',
|
50
|
+
},
|
25
51
|
}),
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
52
|
+
onComplete,
|
53
|
+
onError,
|
54
|
+
helpers,
|
55
|
+
});
|
56
|
+
expect(onComplete).toHaveBeenCalledWith({
|
57
|
+
events: [
|
58
|
+
{
|
59
|
+
date: expect.any(String),
|
60
|
+
text: {
|
61
|
+
en: 'The patient already had an identifier with system https://www.system.com/ and value existingIdentifierValue. The identifier value has been updated to identifier-value.',
|
62
|
+
},
|
63
|
+
},
|
64
|
+
],
|
65
|
+
});
|
66
|
+
expect(onError).not.toHaveBeenCalled();
|
67
|
+
});
|
68
|
+
});
|
69
|
+
describe('Current patient does not have an identifier of the same system', () => {
|
70
|
+
test('Should add the provided identifier system and value to the patient', async () => {
|
71
|
+
/**
|
72
|
+
* Mocking the SDK's response to simulate a scenario where the current patient
|
73
|
+
* does not have an identifier of the same system (but could have an identifier of a different system)
|
74
|
+
*/
|
75
|
+
const awellSdkMock = {
|
76
|
+
orchestration: {
|
77
|
+
mutation: jest.fn().mockResolvedValue({}),
|
78
|
+
query: jest.fn().mockResolvedValue({
|
79
|
+
patientByIdentifier: {
|
80
|
+
patient: {
|
81
|
+
id: 'some-patient-id',
|
82
|
+
profile: {
|
83
|
+
identifier: [
|
84
|
+
{
|
85
|
+
system: 'https://www.another-system.com/',
|
86
|
+
value: 'value',
|
87
|
+
},
|
88
|
+
],
|
89
|
+
},
|
90
|
+
},
|
91
|
+
},
|
92
|
+
}),
|
93
|
+
},
|
94
|
+
};
|
95
|
+
helpers.awellSdk = jest.fn().mockResolvedValue(awellSdkMock);
|
96
|
+
// Simulate an event where a new identifier system and value is provided
|
97
|
+
await extensionAction.onEvent({
|
98
|
+
payload: (0, tests_1.generateTestPayload)({
|
99
|
+
fields: {
|
100
|
+
system: 'https://www.system.com/',
|
101
|
+
value: 'newIdentifierValue',
|
102
|
+
},
|
103
|
+
settings: {},
|
104
|
+
patient: {
|
105
|
+
id: 'some-patient-id',
|
106
|
+
},
|
107
|
+
}),
|
108
|
+
onComplete,
|
109
|
+
onError,
|
110
|
+
helpers,
|
111
|
+
});
|
112
|
+
expect(onComplete).toHaveBeenCalledWith({
|
113
|
+
events: [
|
114
|
+
{
|
115
|
+
date: expect.any(String),
|
116
|
+
text: {
|
117
|
+
en: 'The identifier with system https://www.system.com/ and value newIdentifierValue has been added to the patient.',
|
118
|
+
},
|
119
|
+
},
|
120
|
+
],
|
121
|
+
});
|
122
|
+
expect(onError).not.toHaveBeenCalled();
|
123
|
+
});
|
124
|
+
});
|
125
|
+
});
|
126
|
+
describe('A patient with the provided identifier system and value already exists', () => {
|
127
|
+
describe('Existing patient is the current patient', () => {
|
128
|
+
describe('The new identifier value is the same as the existing value', () => {
|
129
|
+
test('It should not update the patient', async () => {
|
130
|
+
/**
|
131
|
+
* Mocking the SDK's response to simulate a scenario where the current patient
|
132
|
+
* already has an identifier of the same system and value
|
133
|
+
*/
|
134
|
+
const awellSdkMock = {
|
135
|
+
orchestration: {
|
136
|
+
mutation: jest.fn().mockResolvedValue({}),
|
137
|
+
query: jest.fn().mockResolvedValue({
|
138
|
+
patientByIdentifier: {
|
139
|
+
patient: {
|
140
|
+
id: 'some-patient-id',
|
141
|
+
profile: {
|
142
|
+
identifier: [
|
143
|
+
{
|
144
|
+
system: 'https://www.system.com/',
|
145
|
+
value: 'existingIdentifierValue',
|
146
|
+
},
|
147
|
+
],
|
148
|
+
},
|
149
|
+
},
|
150
|
+
},
|
151
|
+
}),
|
152
|
+
},
|
153
|
+
};
|
154
|
+
helpers.awellSdk = jest.fn().mockResolvedValue(awellSdkMock);
|
155
|
+
// Simulate an event where an existing identifier system is updated to the same value
|
156
|
+
await extensionAction.onEvent({
|
157
|
+
payload: (0, tests_1.generateTestPayload)({
|
158
|
+
fields: {
|
159
|
+
system: 'https://www.system.com/',
|
160
|
+
value: 'existingIdentifierValue', // The new value is equal to the existing value
|
161
|
+
},
|
162
|
+
settings: {},
|
163
|
+
patient: {
|
164
|
+
id: 'some-patient-id',
|
165
|
+
},
|
166
|
+
}),
|
167
|
+
onComplete,
|
168
|
+
onError,
|
169
|
+
helpers,
|
170
|
+
});
|
171
|
+
expect(onComplete).toHaveBeenCalledWith({
|
172
|
+
events: [
|
173
|
+
{
|
174
|
+
date: expect.any(String),
|
175
|
+
text: {
|
176
|
+
en: 'Patient already had an identifier of the same value and system. No changes were made.',
|
177
|
+
},
|
178
|
+
},
|
179
|
+
],
|
180
|
+
});
|
181
|
+
expect(onError).not.toHaveBeenCalled();
|
182
|
+
});
|
183
|
+
});
|
184
|
+
describe('The new identifier value is different from the existing value', () => {
|
185
|
+
test('It should update the identifier to the new value', async () => {
|
186
|
+
/**
|
187
|
+
* Mocking the SDK's response to simulate a scenario where the current patient
|
188
|
+
* already has an identifier of the same system and value
|
189
|
+
*/
|
190
|
+
const awellSdkMock = {
|
191
|
+
orchestration: {
|
192
|
+
mutation: jest.fn().mockResolvedValue({}),
|
193
|
+
query: jest.fn().mockResolvedValue({
|
194
|
+
patientByIdentifier: {
|
195
|
+
patient: {
|
196
|
+
id: 'some-patient-id',
|
197
|
+
profile: {
|
198
|
+
identifier: [
|
199
|
+
{
|
200
|
+
system: 'https://www.system.com/',
|
201
|
+
value: 'existingIdentifierValue',
|
202
|
+
},
|
203
|
+
],
|
204
|
+
},
|
205
|
+
},
|
206
|
+
},
|
207
|
+
}),
|
208
|
+
},
|
209
|
+
};
|
210
|
+
helpers.awellSdk = jest.fn().mockResolvedValue(awellSdkMock);
|
211
|
+
// Simulate an event where an existing identifier system is updated to a new value
|
212
|
+
await extensionAction.onEvent({
|
213
|
+
payload: (0, tests_1.generateTestPayload)({
|
214
|
+
fields: {
|
215
|
+
system: 'https://www.system.com/',
|
216
|
+
value: 'newIdentifierValue', // The new value is different from the existing value
|
217
|
+
},
|
218
|
+
settings: {},
|
219
|
+
patient: {
|
220
|
+
id: 'some-patient-id',
|
221
|
+
},
|
222
|
+
}),
|
223
|
+
onComplete,
|
224
|
+
onError,
|
225
|
+
helpers,
|
226
|
+
});
|
227
|
+
expect(onComplete).toHaveBeenCalledWith({
|
228
|
+
events: [
|
229
|
+
{
|
230
|
+
date: expect.any(String),
|
231
|
+
text: {
|
232
|
+
en: 'The patient already had an identifier with system https://www.system.com/ and value existingIdentifierValue. The identifier value has been updated to newIdentifierValue.',
|
233
|
+
},
|
234
|
+
},
|
235
|
+
],
|
236
|
+
});
|
237
|
+
expect(onError).not.toHaveBeenCalled();
|
238
|
+
});
|
239
|
+
});
|
240
|
+
});
|
241
|
+
describe('Existing patient is not the current patient', () => {
|
242
|
+
test('It should throw an error', async () => {
|
243
|
+
/**
|
244
|
+
* Mocking the SDK's response to simulate a scenario where another patient
|
245
|
+
* already has an identifier of the same system and value
|
246
|
+
*/
|
247
|
+
const awellSdkMock = {
|
248
|
+
orchestration: {
|
249
|
+
mutation: jest.fn().mockResolvedValue({}),
|
250
|
+
query: jest.fn().mockResolvedValue({
|
251
|
+
patientByIdentifier: {
|
252
|
+
patient: {
|
253
|
+
id: 'some-patient-id',
|
254
|
+
profile: {
|
255
|
+
identifier: [
|
256
|
+
{
|
257
|
+
system: 'https://www.system.com/',
|
258
|
+
value: 'existingIdentifierValue',
|
259
|
+
},
|
260
|
+
],
|
261
|
+
},
|
262
|
+
},
|
263
|
+
},
|
264
|
+
}),
|
265
|
+
},
|
266
|
+
};
|
267
|
+
helpers.awellSdk = jest.fn().mockResolvedValue(awellSdkMock);
|
268
|
+
// Simulate an event where the action is executed for a patient different from the current one
|
269
|
+
await extensionAction.onEvent({
|
270
|
+
payload: (0, tests_1.generateTestPayload)({
|
271
|
+
fields: {
|
272
|
+
system: 'https://www.system.com/',
|
273
|
+
value: 'newIdentifierValue',
|
274
|
+
},
|
275
|
+
settings: {},
|
276
|
+
patient: {
|
277
|
+
id: 'another-patient-id', // Different patient
|
278
|
+
},
|
279
|
+
}),
|
280
|
+
onComplete,
|
281
|
+
onError,
|
282
|
+
helpers,
|
283
|
+
});
|
284
|
+
expect(onError).toHaveBeenCalledWith({
|
285
|
+
events: [
|
286
|
+
{
|
287
|
+
date: expect.any(String),
|
288
|
+
text: {
|
289
|
+
en: 'Another patient (some-patient-id) already has an identifier with system https://www.system.com/ and value newIdentifierValue. Adding this identifier to the current patient is not possible.',
|
290
|
+
},
|
291
|
+
},
|
292
|
+
],
|
293
|
+
});
|
294
|
+
expect(onComplete).not.toHaveBeenCalled();
|
295
|
+
});
|
296
|
+
});
|
33
297
|
});
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
298
|
+
describe('When the patient has multiple identifiers', () => {
|
299
|
+
test('We should PATCH the new identifier and not remove existing ones', async () => {
|
300
|
+
// Mocking the SDK's response for an existing patient with multiple identifiers
|
301
|
+
const awellSdkMock = {
|
302
|
+
orchestration: {
|
303
|
+
mutation: jest.fn().mockResolvedValue({}),
|
304
|
+
query: jest.fn().mockResolvedValue({
|
305
|
+
patientByIdentifier: {
|
306
|
+
patient: {
|
307
|
+
id: 'some-patient-id',
|
308
|
+
profile: {
|
309
|
+
identifier: [
|
310
|
+
{
|
311
|
+
system: 'https://www.system-1.com/',
|
312
|
+
value: 'value-1',
|
313
|
+
},
|
314
|
+
{
|
315
|
+
system: 'https://www.system-2.com/',
|
316
|
+
value: 'value-2', // Identifier we want to update
|
317
|
+
},
|
318
|
+
{
|
319
|
+
system: 'https://www.system-3.com/',
|
320
|
+
value: 'value-3',
|
321
|
+
},
|
322
|
+
],
|
323
|
+
},
|
324
|
+
},
|
325
|
+
},
|
326
|
+
}),
|
40
327
|
},
|
41
|
-
|
42
|
-
|
43
|
-
|
328
|
+
};
|
329
|
+
helpers.awellSdk = jest.fn().mockResolvedValue(awellSdkMock);
|
330
|
+
// Simulate an event where a new identifier value is provided for an existing system
|
331
|
+
await extensionAction.onEvent({
|
332
|
+
payload: (0, tests_1.generateTestPayload)({
|
333
|
+
fields: {
|
334
|
+
system: 'https://www.system-2.com/',
|
335
|
+
value: 'newIdentifierValue',
|
336
|
+
},
|
337
|
+
settings: {},
|
338
|
+
patient: {
|
339
|
+
id: 'some-patient-id',
|
340
|
+
},
|
341
|
+
}),
|
342
|
+
onComplete,
|
343
|
+
onError,
|
344
|
+
helpers,
|
345
|
+
});
|
346
|
+
expect(awellSdkMock.orchestration.mutation).toHaveBeenCalledWith({
|
347
|
+
updatePatient: {
|
348
|
+
__args: {
|
349
|
+
input: {
|
350
|
+
patient_id: 'some-patient-id',
|
351
|
+
profile: {
|
352
|
+
identifier: [
|
353
|
+
// Retain existing identifiers that aren't being updated
|
354
|
+
{
|
355
|
+
system: 'https://www.system-1.com/',
|
356
|
+
value: 'value-1',
|
357
|
+
},
|
358
|
+
{
|
359
|
+
system: 'https://www.system-3.com/',
|
360
|
+
value: 'value-3',
|
361
|
+
},
|
362
|
+
// Update the identifier with the matching system to the new value
|
363
|
+
{
|
364
|
+
system: 'https://www.system-2.com/',
|
365
|
+
value: 'newIdentifierValue',
|
366
|
+
},
|
367
|
+
],
|
368
|
+
},
|
369
|
+
},
|
370
|
+
},
|
371
|
+
patient: expect.any(Object),
|
44
372
|
},
|
45
|
-
})
|
46
|
-
onComplete,
|
47
|
-
onError,
|
48
|
-
helpers,
|
373
|
+
});
|
49
374
|
});
|
50
|
-
expect(true).toBe(true);
|
51
|
-
// expect(onComplete).toHaveBeenCalled()
|
52
|
-
// expect(onError).not.toHaveBeenCalled()
|
53
375
|
});
|
54
376
|
});
|
55
377
|
//# sourceMappingURL=addIdentifierToPatient.test.js.map
|
package/dist/extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.test.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addIdentifierToPatient.test.js","sourceRoot":"","sources":["../../../../../../extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.test.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"addIdentifierToPatient.test.js","sourceRoot":"","sources":["../../../../../../extensions/awell/v1/actions/addIdentifierToPatient/addIdentifierToPatient.test.ts"],"names":[],"mappings":";;AACA,mCAA6C;AAC7C,qEAAiE;AACjE,mEAA2D;AAE3D,IAAI,CAAC,IAA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type: FieldType.DATE;
|
36
36
|
required: true;
|
37
37
|
};
|
38
|
+
notes: {
|
39
|
+
id: string;
|
40
|
+
label: string;
|
41
|
+
description: string;
|
42
|
+
type: FieldType.TEXT;
|
43
|
+
required: false;
|
44
|
+
};
|
45
|
+
externalVideochatUrl: {
|
46
|
+
id: string;
|
47
|
+
label: string;
|
48
|
+
description: string;
|
49
|
+
type: FieldType.STRING;
|
50
|
+
required: false;
|
51
|
+
};
|
38
52
|
metadata: {
|
39
53
|
id: string;
|
40
54
|
label: string;
|
@@ -49,6 +63,8 @@ export declare const FieldsValidationSchema: z.ZodObject<{
|
|
49
63
|
contactTypeId: z.ZodString;
|
50
64
|
appointmentTypeId: z.ZodString;
|
51
65
|
datetime: z.ZodEffects<z.ZodDate, string, Date>;
|
66
|
+
notes: z.ZodOptional<z.ZodString>;
|
67
|
+
externalVideochatUrl: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
52
68
|
metadata: z.ZodEffects<z.ZodOptional<z.ZodString>, Record<string, any>, string | undefined>;
|
53
69
|
}, "strip", z.ZodTypeAny, {
|
54
70
|
patientId: string;
|
@@ -56,12 +72,16 @@ export declare const FieldsValidationSchema: z.ZodObject<{
|
|
56
72
|
metadata: Record<string, any>;
|
57
73
|
datetime: string;
|
58
74
|
contactTypeId: string;
|
75
|
+
notes?: string | undefined;
|
59
76
|
otherPartyId?: string | undefined;
|
77
|
+
externalVideochatUrl?: string | undefined;
|
60
78
|
}, {
|
61
79
|
patientId: string;
|
62
80
|
appointmentTypeId: string;
|
63
81
|
datetime: Date;
|
64
82
|
contactTypeId: string;
|
65
83
|
metadata?: string | undefined;
|
84
|
+
notes?: string | undefined;
|
66
85
|
otherPartyId?: string | undefined;
|
86
|
+
externalVideochatUrl?: string | undefined;
|
67
87
|
}>;
|
@@ -39,6 +39,20 @@ exports.fields = {
|
|
39
39
|
type: extensions_core_1.FieldType.DATE,
|
40
40
|
required: true,
|
41
41
|
},
|
42
|
+
notes: {
|
43
|
+
id: 'notes',
|
44
|
+
label: 'Notes',
|
45
|
+
description: 'Any notes you want to add to the appointment.',
|
46
|
+
type: extensions_core_1.FieldType.TEXT,
|
47
|
+
required: false,
|
48
|
+
},
|
49
|
+
externalVideochatUrl: {
|
50
|
+
id: 'externalVideochatUrl',
|
51
|
+
label: 'External video chat URL',
|
52
|
+
description: 'When passed in, this video chat URL will be used instead of built-in Video Chat or Zoom.',
|
53
|
+
type: extensions_core_1.FieldType.STRING,
|
54
|
+
required: false,
|
55
|
+
},
|
42
56
|
metadata: {
|
43
57
|
id: 'metadata',
|
44
58
|
label: 'Metadata',
|
@@ -53,6 +67,15 @@ exports.FieldsValidationSchema = zod_1.z.object({
|
|
53
67
|
contactTypeId: zod_1.z.string().min(1),
|
54
68
|
appointmentTypeId: zod_1.z.string().min(1),
|
55
69
|
datetime: extensions_core_1.DateTimeSchema,
|
70
|
+
notes: zod_1.z.string().optional(),
|
71
|
+
externalVideochatUrl: zod_1.z
|
72
|
+
.string()
|
73
|
+
.optional()
|
74
|
+
.transform((val) => {
|
75
|
+
if ((0, lodash_1.isEmpty)(val))
|
76
|
+
return undefined;
|
77
|
+
return val;
|
78
|
+
}),
|
56
79
|
metadata: zod_1.z
|
57
80
|
.string()
|
58
81
|
.optional()
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/actions/createAppointment/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAIsC;AACtC,mCAAuC;AACvC,6BAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,8DAA8D;QAC3E,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,yHAAyH;QAC3H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,EAAC,GAAG,CAAC;YAAE,OAAO,EAAE,CAAA;QACzC,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;SACvB;QAAC,OAAO,CAAC,EAAE;YACV,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAA;YACzD,OAAO,OAAC,CAAC,KAAK,CAAA;SACf;IACH,CAAC,CAAC;CAC6C,CAAC,CAAA"}
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/actions/createAppointment/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAIsC;AACtC,mCAAuC;AACvC,6BAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,8DAA8D;QAC3E,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,yHAAyH;QAC3H,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;IACD,aAAa,EAAE;QACb,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,wCAAwC;QACrD,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EAAE,iCAAiC;QAC9C,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,2BAA2B;QAClC,WAAW,EAAE,yDAAyD;QACtE,IAAI,EAAE,2BAAS,CAAC,IAAI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,CAAC,CAAC,GAAG,EAAE,GAAG,EAAuB,EAAE;QAC3C,IAAI,IAAA,cAAK,EAAC,GAAG,CAAC,IAAI,IAAA,gBAAO,EAAC,GAAG,CAAC;YAAE,OAAO,EAAE,CAAA;QACzC,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;SACvB;QAAC,OAAO,CAAC,EAAE;YACV,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAA;YACzD,OAAO,OAAC,CAAC,KAAK,CAAA;SACf;IACH,CAAC,CAAC;CAC6C,CAAC,CAAA"}
|
@@ -2,8 +2,10 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.createAppointment = void 0;
|
4
4
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
|
+
const errors_1 = require("@extensions/healthie/lib/sdk/graphql-codegen/errors");
|
5
6
|
const validatePayloadAndCreateSdk_1 = require("../../lib/sdk/validatePayloadAndCreateSdk");
|
6
7
|
const config_1 = require("./config");
|
8
|
+
const errors_2 = require("./lib/errors");
|
7
9
|
exports.createAppointment = {
|
8
10
|
key: 'createAppointment',
|
9
11
|
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
@@ -12,25 +14,58 @@ exports.createAppointment = {
|
|
12
14
|
fields: config_1.fields,
|
13
15
|
dataPoints: config_1.dataPoints,
|
14
16
|
previewable: false,
|
15
|
-
|
17
|
+
onEvent: async ({ payload, onComplete, onError, helpers }) => {
|
16
18
|
var _a, _b;
|
17
|
-
const { fields
|
19
|
+
const { fields, healthieSdk } = await (0, validatePayloadAndCreateSdk_1.validatePayloadAndCreateSdk)({
|
18
20
|
fieldsSchema: config_1.FieldsValidationSchema,
|
19
21
|
payload,
|
20
22
|
});
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
try {
|
24
|
+
const res = await healthieSdk.client.mutation({
|
25
|
+
createAppointment: {
|
26
|
+
__args: {
|
27
|
+
input: {
|
28
|
+
appointment_type_id: fields.appointmentTypeId,
|
29
|
+
contact_type: fields.contactTypeId,
|
30
|
+
other_party_id: fields.otherPartyId,
|
31
|
+
datetime: fields.datetime,
|
32
|
+
user_id: fields.patientId,
|
33
|
+
metadata: JSON.stringify(fields.metadata),
|
34
|
+
notes: fields.notes,
|
35
|
+
external_videochat_url: fields.externalVideochatUrl,
|
36
|
+
},
|
37
|
+
},
|
38
|
+
appointment: {
|
39
|
+
id: true,
|
40
|
+
},
|
41
|
+
},
|
42
|
+
});
|
43
|
+
const appointmentId = (_b = (_a = res.createAppointment) === null || _a === void 0 ? void 0 : _a.appointment) === null || _b === void 0 ? void 0 : _b.id;
|
44
|
+
if (appointmentId === undefined)
|
45
|
+
throw new errors_2.HealthieAppointmentNotCreated(res);
|
46
|
+
await onComplete({
|
47
|
+
data_points: {
|
48
|
+
appointmentId,
|
49
|
+
},
|
50
|
+
});
|
51
|
+
}
|
52
|
+
catch (error) {
|
53
|
+
if (error instanceof errors_2.HealthieAppointmentNotCreated) {
|
54
|
+
await onError({
|
55
|
+
events: [(0, errors_2.parseHealthieAppointmentNotCreatedError)(error.errors)],
|
56
|
+
});
|
57
|
+
}
|
58
|
+
else if (error instanceof errors_1.HealthieError) {
|
59
|
+
const errors = (0, errors_1.mapHealthieToActivityError)(error.errors);
|
60
|
+
await onError({
|
61
|
+
events: errors,
|
62
|
+
});
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
// Handles Zod and other unknown errors
|
66
|
+
throw error;
|
67
|
+
}
|
68
|
+
}
|
34
69
|
},
|
35
70
|
};
|
36
71
|
//# sourceMappingURL=createAppointment.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createAppointment.js","sourceRoot":"","sources":["../../../../../extensions/healthie/actions/createAppointment/createAppointment.ts"],"names":[],"mappings":";;;AACA,mEAAwD;AACxD,2FAAuF;AAEvF,qCAAqE;
|
1
|
+
{"version":3,"file":"createAppointment.js","sourceRoot":"","sources":["../../../../../extensions/healthie/actions/createAppointment/createAppointment.ts"],"names":[],"mappings":";;;AACA,mEAAwD;AACxD,gFAG4D;AAC5D,2FAAuF;AAEvF,qCAAqE;AACrE,yCAGqB;AAER,QAAA,iBAAiB,GAI1B;IACF,GAAG,EAAE,mBAAmB;IACxB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EAAE,uCAAuC;IACpD,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;;QAC3D,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,yDAA2B,EAAC;YAChE,YAAY,EAAE,+BAAsB;YACpC,OAAO;SACR,CAAC,CAAA;QAEF,IAAI;YACF,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAC5C,iBAAiB,EAAE;oBACjB,MAAM,EAAE;wBACN,KAAK,EAAE;4BACL,mBAAmB,EAAE,MAAM,CAAC,iBAAiB;4BAC7C,YAAY,EAAE,MAAM,CAAC,aAAa;4BAClC,cAAc,EAAE,MAAM,CAAC,YAAY;4BACnC,QAAQ,EAAE,MAAM,CAAC,QAAQ;4BACzB,OAAO,EAAE,MAAM,CAAC,SAAS;4BACzB,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC;4BACzC,KAAK,EAAE,MAAM,CAAC,KAAK;4BACnB,sBAAsB,EAAE,MAAM,CAAC,oBAAoB;yBACpD;qBACF;oBACD,WAAW,EAAE;wBACX,EAAE,EAAE,IAAI;qBACT;iBACF;aACF,CAAC,CAAA;YAEF,MAAM,aAAa,GAAG,MAAA,MAAA,GAAG,CAAC,iBAAiB,0CAAE,WAAW,0CAAE,EAAE,CAAA;YAE5D,IAAI,aAAa,KAAK,SAAS;gBAC7B,MAAM,IAAI,sCAA6B,CAAC,GAAG,CAAC,CAAA;YAE9C,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,aAAa;iBACd;aACF,CAAC,CAAA;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,YAAY,sCAA6B,EAAE;gBAClD,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,CAAC,IAAA,gDAAuC,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;iBAChE,CAAC,CAAA;aACH;iBAAM,IAAI,KAAK,YAAY,sBAAa,EAAE;gBACzC,MAAM,MAAM,GAAG,IAAA,mCAA0B,EAAC,KAAK,CAAC,MAAM,CAAC,CAAA;gBACvD,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,MAAM;iBACf,CAAC,CAAA;aACH;iBAAM;gBACL,uCAAuC;gBACvC,MAAM,KAAK,CAAA;aACZ;SACF;IACH,CAAC;CACF,CAAA"}
|
@@ -1,37 +1,69 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const tests_1 = require("../../../../src/tests");
|
4
|
-
const
|
5
|
-
const sdk_2 = require("../../lib/sdk/graphql-codegen/generated/__mocks__/sdk");
|
4
|
+
const genql_1 = require("@extensions/healthie/lib/sdk/genql");
|
6
5
|
const _1 = require(".");
|
7
|
-
|
8
|
-
jest.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
7
|
+
const mockedMutationResponse = jest.fn().mockResolvedValue({
|
8
|
+
createAppointment: {
|
9
|
+
appointment: {
|
10
|
+
id: 'appointment-id-1',
|
11
|
+
},
|
12
|
+
},
|
13
|
+
});
|
14
|
+
jest.mock('@extensions/healthie/lib/sdk/genql', () => ({
|
15
|
+
HealthieSdk: jest.fn().mockImplementation(() => ({
|
16
|
+
client: {
|
17
|
+
mutation: mockedMutationResponse,
|
18
|
+
},
|
19
|
+
})),
|
20
|
+
}));
|
21
|
+
const mockedHealthieSdk = jest.mocked(genql_1.HealthieSdk);
|
22
|
+
describe('Healthie - Create appointment', () => {
|
23
|
+
const { extensionAction: action, onComplete, onError, helpers, clearMocks, } = extensions_core_1.TestHelpers.fromAction(_1.createAppointment);
|
16
24
|
beforeEach(() => {
|
17
|
-
|
25
|
+
clearMocks();
|
18
26
|
});
|
19
27
|
test('Should create an appointment', async () => {
|
20
|
-
await
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
await action.onEvent({
|
29
|
+
payload: (0, tests_1.generateTestPayload)({
|
30
|
+
fields: {
|
31
|
+
patientId: 'a-patient-id',
|
32
|
+
otherPartyId: 'other-party-id',
|
33
|
+
contactTypeId: 'contact-type-id',
|
34
|
+
appointmentTypeId: 'appointment-type-id',
|
35
|
+
datetime: '2024-07-09T07:49:38Z',
|
36
|
+
notes: 'Test appointment\nNew line\n\nDouble enter after new line',
|
37
|
+
externalVideochatUrl: 'https://example.com',
|
38
|
+
metadata: JSON.stringify({ hello: 'world' }),
|
39
|
+
},
|
40
|
+
settings: {
|
41
|
+
apiUrl: 'https://staging-api.gethealthie.com/graphql',
|
42
|
+
apiKey: 'apiKey',
|
43
|
+
},
|
44
|
+
}),
|
45
|
+
onComplete,
|
46
|
+
onError,
|
47
|
+
helpers,
|
48
|
+
});
|
49
|
+
expect(mockedHealthieSdk).toHaveBeenCalled();
|
50
|
+
expect(mockedMutationResponse).toHaveBeenCalledWith({
|
51
|
+
createAppointment: {
|
52
|
+
__args: {
|
53
|
+
input: {
|
54
|
+
appointment_type_id: 'appointment-type-id',
|
55
|
+
contact_type: 'contact-type-id',
|
56
|
+
other_party_id: 'other-party-id',
|
57
|
+
datetime: '2024-07-09T07:49:38Z',
|
58
|
+
user_id: 'a-patient-id',
|
59
|
+
metadata: '{"hello":"world"}',
|
60
|
+
notes: 'Test appointment\nNew line\n\nDouble enter after new line',
|
61
|
+
external_videochat_url: 'https://example.com',
|
62
|
+
},
|
63
|
+
},
|
64
|
+
appointment: expect.any(Object),
|
32
65
|
},
|
33
|
-
})
|
34
|
-
expect(sdk_2.mockGetSdkReturn.createAppointment).toHaveBeenCalled();
|
66
|
+
});
|
35
67
|
expect(onComplete).toHaveBeenCalledWith({
|
36
68
|
data_points: {
|
37
69
|
appointmentId: 'appointment-id-1',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createAppointment.test.js","sourceRoot":"","sources":["../../../../../extensions/healthie/actions/createAppointment/createAppointment.test.ts"],"names":[],"mappings":";;AAAA,iDAA2D;AAC3D,
|
1
|
+
{"version":3,"file":"createAppointment.test.js","sourceRoot":"","sources":["../../../../../extensions/healthie/actions/createAppointment/createAppointment.test.ts"],"names":[],"mappings":";;AAAA,iDAA2D;AAC3D,8DAAgE;AAChE,wBAAwD;AACxD,mEAA2D;AAE3D,MAAM,sBAAsB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC;IACzD,iBAAiB,EAAE;QACjB,WAAW,EAAE;YACX,EAAE,EAAE,kBAAkB;SACvB;KACF;CACF,CAAC,CAAA;AAEF,IAAI,CAAC,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAAC,CAAC;IACrD,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/C,MAAM,EAAE;YACN,QAAQ,EAAE,sBAAsB;SACjC;KACF,CAAC,CAAC;CACJ,CAAC,CAAC,CAAA;AAEH,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CA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,sBAAsB,EAAE,qBAAqB;qBAC9C;iBACF;gBACD,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;aAChC;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,WAAW,EAAE;gBACX,aAAa,EAAE,kBAAkB;aAClC;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { type ActivityEvent } from '@awell-health/extensions-core';
|
2
|
+
export declare class HealthieAppointmentNotCreated extends Error {
|
3
|
+
errors: Record<string, unknown>;
|
4
|
+
constructor(errors: Record<string, unknown>);
|
5
|
+
}
|
6
|
+
export declare const parseHealthieAppointmentNotCreatedError: (error: Record<string, unknown>) => ActivityEvent;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.parseHealthieAppointmentNotCreatedError = exports.HealthieAppointmentNotCreated = void 0;
|
4
|
+
class HealthieAppointmentNotCreated extends Error {
|
5
|
+
constructor(errors) {
|
6
|
+
super('Failed to create the appointment in Healthie.');
|
7
|
+
this.name = 'HealthieAppointmentNotCreated';
|
8
|
+
this.errors = errors;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
exports.HealthieAppointmentNotCreated = HealthieAppointmentNotCreated;
|
12
|
+
const parseHealthieAppointmentNotCreatedError = (error) => {
|
13
|
+
const category = 'BAD_REQUEST';
|
14
|
+
const message = JSON.stringify(error, null, 2);
|
15
|
+
return {
|
16
|
+
date: new Date().toISOString(),
|
17
|
+
text: {
|
18
|
+
en: message,
|
19
|
+
},
|
20
|
+
error: {
|
21
|
+
category,
|
22
|
+
message,
|
23
|
+
},
|
24
|
+
};
|
25
|
+
};
|
26
|
+
exports.parseHealthieAppointmentNotCreatedError = parseHealthieAppointmentNotCreatedError;
|
27
|
+
//# sourceMappingURL=errors.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/actions/createAppointment/lib/errors.ts"],"names":[],"mappings":";;;AAEA,MAAa,6BAA8B,SAAQ,KAAK;IAGtD,YAAY,MAA+B;QACzC,KAAK,CAAC,+CAA+C,CAAC,CAAA;QACtD,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAA;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AARD,sEAQC;AAEM,MAAM,uCAAuC,GAAG,CACrD,KAA8B,EACf,EAAE;IACjB,MAAM,QAAQ,GAAG,aAAa,CAAA;IAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAE9C,OAAO;QACL,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC9B,IAAI,EAAE;YACJ,EAAE,EAAE,OAAO;SACZ;QACD,KAAK,EAAE;YACL,QAAQ;YACR,OAAO;SACR;KACF,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,uCAAuC,2CAgBnD"}
|
@@ -82,6 +82,20 @@ export declare const actions: {
|
|
82
82
|
type: import("@awell-health/extensions-core").FieldType.DATE;
|
83
83
|
required: true;
|
84
84
|
};
|
85
|
+
notes: {
|
86
|
+
id: string;
|
87
|
+
label: string;
|
88
|
+
description: string;
|
89
|
+
type: import("@awell-health/extensions-core").FieldType.TEXT;
|
90
|
+
required: false;
|
91
|
+
};
|
92
|
+
externalVideochatUrl: {
|
93
|
+
id: string;
|
94
|
+
label: string;
|
95
|
+
description: string;
|
96
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
97
|
+
required: false;
|
98
|
+
};
|
85
99
|
metadata: {
|
86
100
|
id: string;
|
87
101
|
label: string;
|
@@ -4,7 +4,7 @@
|
|
4
4
|
"changelog": "# Athena changelog"
|
5
5
|
},
|
6
6
|
"awell": {
|
7
|
-
"readme": "---\ntitle: Awell Workflow\ndescription: Enrich your care flows with powerful Awell actions.\n---\n\n# Awell API extension\n\n## Extension settings\n\nYou will need to provide the [API URL](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/endpoints) and an [API key](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/authorization).\n\n## Custom Actions\n\n### Start care flow\n\nStarts a new care flow for the patient enrolled in your current care flow.\n\n**Passing baseline info:**\nPlease read the documentation on [our developer hub](https://developers.awellhealth.com/awell-orchestration/api-reference/mutations/start-pathway) to learn more about how to pass baseline info.\n\n**Example of how to configure a value for the baseline info action field:**\n\n```json\n[\n {\n \"data_point_definition_id\": \"age\",\n \"value\": \"29\"\n },\n {\n \"data_point_definition_id\": \"dob\",\n \"value\": \"1993-11-30\"\n }\n]\n```\n\n### Stop care flow\n\nStops the care flow the patient is currently enrolled in. A reason is why you are stopping the care flow is mandatory.\n\n### Update patient\n\nAllows updating patient data for the patient currently enrolled in the care flow.\n\n### Is patient already enrolled in care flow\n\nChecks whether the patient is already enrolled in a care flow definition. The care flow the patient is currently enrolled in does not count and is excluded from the results.\n\n**Action fields:**\n\n- pathwayStatus: a comma-separated string of care flow statuses that will be used when looking for care flows the patient is already enrolled in. By default, we only look at active care flows. Options: \"active\", \"completed\", \"missing_baseline_info\", \"starting\", and \"stopped\".\n- careFlowDefinitionIds: a comma-separated string of care flow definition ids that will be used when looking for care flows the patient is already enrolled in. By default, we only search for care flows that match the current care flow definition id (i.e. is the patient already included in the current care flow?).\n\n**Data points:**\n\n- result: a boolean indicating whether the patient is already enrolled in another care flow that matches your criteria (status & care flow definition id)\n- nbrOfResults: the number of care flows found for the patient that match the criteria.\n- careFlowIds: a comma-separated string of care flow ids that matched your search criteria. It will be empty when the result is `false` because then there are no other care flow ids that match your criteria.\n\n### Search patients by patient code\n\nNote that this action is deprecated and we recommend using [identifiers](https://developers.awellhealth.com/awell-orchestration/docs/misc/patient-identifiers) instead.\n\nSearch whether, apart from the patient currently enrolled in the care flow, another patient with the same `patient_code` already exists.\n\n**Data points:**\n\n1. patientAlreadyExists: a boolean which will be true if minimum one patient with the patient code already exists.\n2. numberOfPatientsFound: the number of patients found with the same patient code.\n3. awellPatientIds: a comma-separated string of all Awell patient ids (except the current patient) that have the same patient code as the patient currently enrolled in the care flow. Will return an empty string when there are no other patients with the same patient code.\n\n### Get patient by identifier\n\nThis action lets you check if a patient with a specific identifier already exists in Awell. It's particularly useful when a patient's identity is initially anonymous during the start of the care flow, but later becomes identifiable through the identifiers collected during the care flow. This check ensures whether a patient with that identifier is already present or not.\n\n### Add identifier to patient\n\nThis action
|
7
|
+
"readme": "---\ntitle: Awell Workflow\ndescription: Enrich your care flows with powerful Awell actions.\n---\n\n# Awell API extension\n\n## Extension settings\n\nYou will need to provide the [API URL](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/endpoints) and an [API key](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/authorization).\n\n## Custom Actions\n\n### Start care flow\n\nStarts a new care flow for the patient enrolled in your current care flow.\n\n**Passing baseline info:**\nPlease read the documentation on [our developer hub](https://developers.awellhealth.com/awell-orchestration/api-reference/mutations/start-pathway) to learn more about how to pass baseline info.\n\n**Example of how to configure a value for the baseline info action field:**\n\n```json\n[\n {\n \"data_point_definition_id\": \"age\",\n \"value\": \"29\"\n },\n {\n \"data_point_definition_id\": \"dob\",\n \"value\": \"1993-11-30\"\n }\n]\n```\n\n### Stop care flow\n\nStops the care flow the patient is currently enrolled in. A reason is why you are stopping the care flow is mandatory.\n\n### Update patient\n\nAllows updating patient data for the patient currently enrolled in the care flow.\n\n### Is patient already enrolled in care flow\n\nChecks whether the patient is already enrolled in a care flow definition. The care flow the patient is currently enrolled in does not count and is excluded from the results.\n\n**Action fields:**\n\n- pathwayStatus: a comma-separated string of care flow statuses that will be used when looking for care flows the patient is already enrolled in. By default, we only look at active care flows. Options: \"active\", \"completed\", \"missing_baseline_info\", \"starting\", and \"stopped\".\n- careFlowDefinitionIds: a comma-separated string of care flow definition ids that will be used when looking for care flows the patient is already enrolled in. By default, we only search for care flows that match the current care flow definition id (i.e. is the patient already included in the current care flow?).\n\n**Data points:**\n\n- result: a boolean indicating whether the patient is already enrolled in another care flow that matches your criteria (status & care flow definition id)\n- nbrOfResults: the number of care flows found for the patient that match the criteria.\n- careFlowIds: a comma-separated string of care flow ids that matched your search criteria. It will be empty when the result is `false` because then there are no other care flow ids that match your criteria.\n\n### Search patients by patient code\n\nNote that this action is deprecated and we recommend using [identifiers](https://developers.awellhealth.com/awell-orchestration/docs/misc/patient-identifiers) instead.\n\nSearch whether, apart from the patient currently enrolled in the care flow, another patient with the same `patient_code` already exists.\n\n**Data points:**\n\n1. patientAlreadyExists: a boolean which will be true if minimum one patient with the patient code already exists.\n2. numberOfPatientsFound: the number of patients found with the same patient code.\n3. awellPatientIds: a comma-separated string of all Awell patient ids (except the current patient) that have the same patient code as the patient currently enrolled in the care flow. Will return an empty string when there are no other patients with the same patient code.\n\n### Get patient by identifier\n\nThis action lets you check if a patient with a specific identifier already exists in Awell. It's particularly useful when a patient's identity is initially anonymous during the start of the care flow, but later becomes identifiable through the identifiers collected during the care flow. This check ensures whether a patient with that identifier is already present or not.\n\n### Add identifier to patient\n\nThis action allows you to add a unique identifier to the current patient's profile. If the patient already has an identifier with the same system but a different value, this action will update the existing identifier with the new value provided. \n\nFirst, it checks if this identifier (system and value) is already associated with another patient. If it's safe to proceed, it will add or update the identifier as needed. However, if another patient already has this identifier, the action will stop and notify you, preventing duplicates. To avoid conflicts, we recommend first running the \"Get patient by identifier\" action to check for any existing matches.\n\n## Webhooks\n\nWebhooks in the Awell extension offer ways to trigger a care flow based on the end of another care flow, or from any event that happens in your system (via the pathwayStart webhook).\n",
|
8
8
|
"changelog": "# Awell changelog\n\n## April 2024\n\nTwo new action were added: \"Get patient by identifier\" and \"Add identifier to patient\".\n\n## October 26, 2023\n\nGeneric webhook to start a care flow added\n\n## April 19, 2023\n\nStop care flow action added.\nSearch patients by patient code action was added.\n\"Is patient enrolled in care flow\" action added.\n"
|
9
9
|
},
|
10
10
|
"calDotCom": {
|
@@ -66,15 +66,15 @@ export declare const FieldsValidationSchema: z.ZodObject<{
|
|
66
66
|
resourceType?: ResourceType | undefined;
|
67
67
|
completed?: boolean | undefined;
|
68
68
|
dueDate?: string | undefined;
|
69
|
-
ownerId?: number | undefined;
|
70
69
|
resourceId?: number | undefined;
|
70
|
+
ownerId?: number | undefined;
|
71
71
|
remindAt?: string | undefined;
|
72
72
|
}, {
|
73
73
|
content: string;
|
74
74
|
resourceType?: "" | ResourceType | undefined;
|
75
75
|
completed?: boolean | undefined;
|
76
76
|
dueDate?: "" | Date | undefined;
|
77
|
-
ownerId?: number | "" | undefined;
|
78
77
|
resourceId?: number | "" | undefined;
|
78
|
+
ownerId?: number | "" | undefined;
|
79
79
|
remindAt?: "" | Date | undefined;
|
80
80
|
}>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export type { PatientAdmitted } from './patientAdmitted';
|
2
2
|
export type { PatientDischarged } from './patientDischarged';
|
3
|
-
export declare const webhooks: import("@awell-health/extensions-core").Webhook<"
|
3
|
+
export declare const webhooks: import("@awell-health/extensions-core").Webhook<"resourceId" | "eventType" | "ownerId" | "UPID" | "encounterStatus" | "encounterStart" | "HL7EventType" | "HL7EventTypeDescription" | "HL7EventTypeFull", import("./types").AdtEventWebhookPayload, {
|
4
4
|
base_url: {
|
5
5
|
key: string;
|
6
6
|
label: string;
|
package/dist/src/utils/getNextDateWithinBusinessHours/getNextDateWithinBusinessHours.test.js
CHANGED
@@ -78,12 +78,12 @@ describe('getNextDateWithinBusinessHours', () => {
|
|
78
78
|
expect((0, getNextDateWithinBusinessHours_1.getNextDateWithinBusinessHours)(mockDate, timeZone)).toEqual(mockDate);
|
79
79
|
});
|
80
80
|
it('returns the next day at 9 AM in ISO format when the date is after working hours', () => {
|
81
|
-
const mockDate = (0, date_fns_1.setHours)((0, date_fns_1.startOfDay)(new Date()), 16); // 4 PM UTC is 5 PM in Belgium and is after working hours
|
81
|
+
const mockDate = (0, date_fns_1.setHours)((0, date_fns_1.startOfDay)(new Date('2024-10-01')), 16); // 4 PM UTC is 5 PM in Belgium and is after working hours
|
82
82
|
const expectedDate = (0, date_fns_1.setHours)((0, date_fns_1.startOfDay)((0, date_fns_1.addDays)(mockDate, 1)), 7); // should return 8 AM of the next day in UTC (which is 9 AM Belgium time)
|
83
83
|
expect((0, getNextDateWithinBusinessHours_1.getNextDateWithinBusinessHours)(mockDate, timeZone)).toEqual(expectedDate);
|
84
84
|
});
|
85
85
|
it('returns today at 9 AM in ISO format when the date is before working hours', () => {
|
86
|
-
const mockDate = (0, date_fns_1.setHours)((0, date_fns_1.startOfDay)(new Date()), 7); // 7 AM UTC is 8 AM in Belgum and is before working hours
|
86
|
+
const mockDate = (0, date_fns_1.setHours)((0, date_fns_1.startOfDay)(new Date('2024-10-01')), 7); // 7 AM UTC is 8 AM in Belgum and is before working hours
|
87
87
|
const expectedDate = (0, date_fns_1.setHours)((0, date_fns_1.startOfDay)(mockDate), 7); // should return 8 AM of the same day in UTC (which is 9 AM Belgium time)
|
88
88
|
expect((0, getNextDateWithinBusinessHours_1.getNextDateWithinBusinessHours)(mockDate, timeZone)).toEqual(expectedDate);
|
89
89
|
});
|
package/dist/src/utils/getNextDateWithinBusinessHours/getNextDateWithinBusinessHours.test.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getNextDateWithinBusinessHours.test.js","sourceRoot":"","sources":["../../../../src/utils/getNextDateWithinBusinessHours/getNextDateWithinBusinessHours.test.ts"],"names":[],"mappings":";;AAAA,qFAGyC;AACzC,uCAAwD;AAExD,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;YAC7D,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAA;YAC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;IAEF,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;QAC1C,MAAM,QAAQ,GAAG,iBAAiB,CAAA;QAElC,EAAE,CAAC,6EAA6E,EAAE,GAAG,EAAE;YACrF,MAAM,QAAQ,GAAG,IAAA,mBAAQ,EAAC,IAAA,qBAAU,EAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA,CAAC,8BAA8B;YAEnF,MAAM,CAAC,IAAA,+DAA8B,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAChE,QAAQ,CACT,CAAA;QACH,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,iFAAiF,EAAE,GAAG,EAAE;YACzF,MAAM,QAAQ,GAAG,IAAA,mBAAQ,EAAC,IAAA,qBAAU,EAAC,IAAI,IAAI,
|
1
|
+
{"version":3,"file":"getNextDateWithinBusinessHours.test.js","sourceRoot":"","sources":["../../../../src/utils/getNextDateWithinBusinessHours/getNextDateWithinBusinessHours.test.ts"],"names":[],"mappings":";;AAAA,qFAGyC;AACzC,uCAAwD;AAExD,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;YAC7D,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAA;YAC7C,MAAM,CAAC,IAAA,2DAA0B,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACrD,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;YAC9D,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAA;YAC7C,MAAM,CAAC,IAAA,2DAA0B,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtD,CAAC,CAAC,CAAA;QAEF,EAAE,CAA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