@awell-health/awell-extensions 2.0.50 → 2.0.51
Sign up to get free protection for your applications and to get access to all the features.
- 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/zendesk/v1/actions/createTask/config/fields.d.ts +2 -2
- package/dist/extensions/zusHealth/webhooks/index.d.ts +1 -1
- package/package.json +1 -1
@@ -35,6 +35,20 @@ export declare const fields: {
|
|
35
35
|
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,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;QACpB,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,gCAAc;IACxB,QAAQ,EAAE,OAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,SAAS,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"}
|
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,YA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AAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,gCAAc;IACxB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,oBAAoB,EAAE,OAAC;SACpB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE;QACjB,IAAI,IAAA,gBAAO,EAAC,GAAG,CAAC;YAAE,OAAO,SAAS,CAAA;QAClC,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC;IACJ,QAAQ,EAAE,OAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,SAAS,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,O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,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,CAAC,mBAAW,CAAC,CAAA;AAElD,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,MAAM,EACJ,eAAe,EAAE,MAAM,EACvB,UAAU,EACV,OAAO,EACP,OAAO,EACP,UAAU,GACX,GAAG,6BAAW,CAAC,UAAU,CAAC,oBAAe,CAAC,CAAA;IAE3C,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,MAAM,CAAC,OAAO,CAAC;YACnB,OAAO,EAAE,IAAA,2BAAmB,EAAC;gBAC3B,MAAM,EAAE;oBACN,SAAS,EAAE,cAAc;oBACzB,YAAY,EAAE,gBAAgB;oBAC9B,aAAa,EAAE,iBAAiB;oBAChC,iBAAiB,EAAE,qBAAqB;oBACxC,QAAQ,EAAE,sBAAsB;oBAChC,KAAK,EAAE,2DAA2D;oBAClE,oBAAoB,EAAE,qBAAqB;oBAC3C,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;iBAC7C;gBACD,QAAQ,EAAE;oBACR,MAAM,EAAE,6CAA6C;oBACrD,MAAM,EAAE,QAAQ;iBACjB;aACF,CAAC;YACF,UAAU;YACV,OAAO;YACP,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,EAAE,CAAA;QAC5C,MAAM,CAAC,sBAAsB,CAAC,CAAC,oBAAoB,CAAC;YAClD,iBAAiB,EAAE;gBACjB,MAAM,EAAE;oBACN,KAAK,EAAE;wBACL,mBAAmB,EAAE,qBAAqB;wBAC1C,YAAY,EAAE,iBAAiB;wBAC/B,cAAc,EAAE,gBAAgB;wBAChC,QAAQ,EAAE,sBAAsB;wBAChC,OAAO,EAAE,cAAc;wBACvB,QAAQ,EAAE,mBAAmB;wBAC7B,KAAK,EAAE,2DAA2D;wBAClE,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;
|
@@ -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;
|