@awell-health/awell-extensions 1.0.214 → 1.0.215

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/dist/extensions/athenahealth/actions/createAppointmentNote/config/datapoints.js.map +1 -0
  2. package/dist/extensions/athenahealth/actions/{addProblemToPatientChart → createAppointmentNote}/config/fields.d.ts +19 -18
  3. package/dist/extensions/athenahealth/actions/{addProblemToPatientChart → createAppointmentNote}/config/fields.js +20 -20
  4. package/dist/extensions/athenahealth/actions/createAppointmentNote/config/fields.js.map +1 -0
  5. package/dist/extensions/athenahealth/actions/createAppointmentNote/config/index.js.map +1 -0
  6. package/dist/extensions/athenahealth/actions/{addProblemToPatientChart/addProblemToPatientChart.d.ts → createAppointmentNote/createAppointmentNote.d.ts} +1 -1
  7. package/dist/extensions/athenahealth/actions/{addProblemToPatientChart/addProblemToPatientChart.js → createAppointmentNote/createAppointmentNote.js} +12 -7
  8. package/dist/extensions/athenahealth/actions/createAppointmentNote/createAppointmentNote.js.map +1 -0
  9. package/dist/extensions/athenahealth/actions/createAppointmentNote/createAppointmentNote.test.js +51 -0
  10. package/dist/extensions/athenahealth/actions/createAppointmentNote/createAppointmentNote.test.js.map +1 -0
  11. package/dist/extensions/athenahealth/actions/createAppointmentNote/index.d.ts +1 -0
  12. package/dist/extensions/athenahealth/actions/createAppointmentNote/index.js +6 -0
  13. package/dist/extensions/athenahealth/actions/createAppointmentNote/index.js.map +1 -0
  14. package/dist/extensions/athenahealth/actions/createPatient/config/datapoints.d.ts +6 -0
  15. package/dist/extensions/athenahealth/actions/createPatient/config/datapoints.js +10 -0
  16. package/dist/extensions/athenahealth/actions/createPatient/config/datapoints.js.map +1 -0
  17. package/dist/extensions/athenahealth/actions/createPatient/config/fields.d.ts +69 -0
  18. package/dist/extensions/athenahealth/actions/createPatient/config/fields.js +62 -0
  19. package/dist/extensions/athenahealth/actions/createPatient/config/fields.js.map +1 -0
  20. package/dist/extensions/athenahealth/actions/createPatient/config/index.js.map +1 -0
  21. package/dist/extensions/athenahealth/actions/{cancelAppointment/cancelAppointment.d.ts → createPatient/createPatient.d.ts} +1 -1
  22. package/dist/extensions/athenahealth/actions/{cancelAppointment/cancelAppointment.js → createPatient/createPatient.js} +16 -8
  23. package/dist/extensions/athenahealth/actions/createPatient/createPatient.js.map +1 -0
  24. package/dist/extensions/athenahealth/actions/createPatient/createPatient.test.js +33 -0
  25. package/dist/extensions/athenahealth/actions/createPatient/createPatient.test.js.map +1 -0
  26. package/dist/extensions/athenahealth/actions/createPatient/index.d.ts +1 -0
  27. package/dist/extensions/athenahealth/actions/createPatient/index.js +6 -0
  28. package/dist/extensions/athenahealth/actions/createPatient/index.js.map +1 -0
  29. package/dist/extensions/athenahealth/actions/getAppointment/config/datapoints.d.ts +9 -1
  30. package/dist/extensions/athenahealth/actions/getAppointment/config/datapoints.js +9 -1
  31. package/dist/extensions/athenahealth/actions/getAppointment/config/datapoints.js.map +1 -1
  32. package/dist/extensions/athenahealth/actions/getAppointment/getAppointment.js +11 -6
  33. package/dist/extensions/athenahealth/actions/getAppointment/getAppointment.js.map +1 -1
  34. package/dist/extensions/athenahealth/actions/getAppointment/getAppointment.test.js +40 -15
  35. package/dist/extensions/athenahealth/actions/getAppointment/getAppointment.test.js.map +1 -1
  36. package/dist/extensions/athenahealth/actions/getPatient/getPatient.js +8 -7
  37. package/dist/extensions/athenahealth/actions/getPatient/getPatient.js.map +1 -1
  38. package/dist/extensions/athenahealth/actions/getPatient/getPatient.test.js +38 -15
  39. package/dist/extensions/athenahealth/actions/getPatient/getPatient.test.js.map +1 -1
  40. package/dist/extensions/athenahealth/actions/index.d.ts +18 -70
  41. package/dist/extensions/athenahealth/actions/index.js +8 -6
  42. package/dist/extensions/athenahealth/actions/index.js.map +1 -1
  43. package/dist/extensions/athenahealth/api/client.d.ts +32 -2
  44. package/dist/extensions/athenahealth/api/client.js +38 -2
  45. package/dist/extensions/athenahealth/api/client.js.map +1 -1
  46. package/dist/extensions/athenahealth/api/schema/appointment.d.ts +36 -0
  47. package/dist/extensions/athenahealth/api/schema/appointment.js +21 -0
  48. package/dist/extensions/athenahealth/api/schema/appointment.js.map +1 -0
  49. package/dist/extensions/athenahealth/api/schema/date.d.ts +7 -0
  50. package/dist/extensions/athenahealth/api/schema/date.js +23 -0
  51. package/dist/extensions/athenahealth/api/schema/date.js.map +1 -0
  52. package/dist/extensions/athenahealth/api/schema/index.d.ts +3 -0
  53. package/dist/extensions/athenahealth/api/schema/index.js +11 -0
  54. package/dist/extensions/athenahealth/api/schema/index.js.map +1 -0
  55. package/dist/extensions/athenahealth/api/schema/patient.d.ts +42 -0
  56. package/dist/extensions/athenahealth/api/schema/patient.js +22 -0
  57. package/dist/extensions/athenahealth/api/schema/patient.js.map +1 -0
  58. package/dist/extensions/athenahealth/api/schema/schema.test.d.ts +1 -0
  59. package/dist/extensions/athenahealth/api/schema/schema.test.js +22 -0
  60. package/dist/extensions/athenahealth/api/schema/schema.test.js.map +1 -0
  61. package/dist/extensions/athenahealth/validation/date.d.ts +6 -0
  62. package/dist/extensions/athenahealth/validation/date.js +22 -0
  63. package/dist/extensions/athenahealth/validation/date.js.map +1 -0
  64. package/dist/extensions/athenahealth/validation/validation.test.d.ts +1 -0
  65. package/dist/extensions/athenahealth/validation/validation.test.js +12 -0
  66. package/dist/extensions/athenahealth/validation/validation.test.js.map +1 -0
  67. package/dist/extensions/markdown.json +1 -1
  68. package/package.json +1 -1
  69. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/addProblemToPatientChart.js.map +0 -1
  70. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/addProblemToPatientChart.test.js +0 -29
  71. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/addProblemToPatientChart.test.js.map +0 -1
  72. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/config/datapoints.js.map +0 -1
  73. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/config/fields.js.map +0 -1
  74. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/config/index.js.map +0 -1
  75. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/index.d.ts +0 -1
  76. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/index.js +0 -6
  77. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/index.js.map +0 -1
  78. package/dist/extensions/athenahealth/actions/cancelAppointment/cancelAppointment.js.map +0 -1
  79. package/dist/extensions/athenahealth/actions/cancelAppointment/cancelAppointment.test.js +0 -27
  80. package/dist/extensions/athenahealth/actions/cancelAppointment/cancelAppointment.test.js.map +0 -1
  81. package/dist/extensions/athenahealth/actions/cancelAppointment/config/datapoints.d.ts +0 -1
  82. package/dist/extensions/athenahealth/actions/cancelAppointment/config/datapoints.js +0 -5
  83. package/dist/extensions/athenahealth/actions/cancelAppointment/config/datapoints.js.map +0 -1
  84. package/dist/extensions/athenahealth/actions/cancelAppointment/config/fields.d.ts +0 -28
  85. package/dist/extensions/athenahealth/actions/cancelAppointment/config/fields.js +0 -29
  86. package/dist/extensions/athenahealth/actions/cancelAppointment/config/fields.js.map +0 -1
  87. package/dist/extensions/athenahealth/actions/cancelAppointment/config/index.js.map +0 -1
  88. package/dist/extensions/athenahealth/actions/cancelAppointment/index.d.ts +0 -1
  89. package/dist/extensions/athenahealth/actions/cancelAppointment/index.js +0 -6
  90. package/dist/extensions/athenahealth/actions/cancelAppointment/index.js.map +0 -1
  91. /package/dist/extensions/athenahealth/actions/{addProblemToPatientChart → createAppointmentNote}/config/datapoints.d.ts +0 -0
  92. /package/dist/extensions/athenahealth/actions/{addProblemToPatientChart → createAppointmentNote}/config/datapoints.js +0 -0
  93. /package/dist/extensions/athenahealth/actions/{addProblemToPatientChart → createAppointmentNote}/config/index.d.ts +0 -0
  94. /package/dist/extensions/athenahealth/actions/{addProblemToPatientChart → createAppointmentNote}/config/index.js +0 -0
  95. /package/dist/extensions/athenahealth/actions/{addProblemToPatientChart/addProblemToPatientChart.test.d.ts → createAppointmentNote/createAppointmentNote.test.d.ts} +0 -0
  96. /package/dist/extensions/athenahealth/actions/{cancelAppointment → createPatient}/config/index.d.ts +0 -0
  97. /package/dist/extensions/athenahealth/actions/{cancelAppointment → createPatient}/config/index.js +0 -0
  98. /package/dist/extensions/athenahealth/actions/{cancelAppointment/cancelAppointment.test.d.ts → createPatient/createPatient.test.d.ts} +0 -0
@@ -1,35 +1,60 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const date_fns_1 = require("date-fns");
3
4
  const _1 = require(".");
4
5
  const tests_1 = require("../../../../src/tests");
5
- describe('Athena - Get appointment', () => {
6
- const settings = {
7
- client_id: 'hello',
8
- client_secret: 'world',
9
- auth_url: 'https://api.preview.platform.athenahealth.com/oauth2/v1/token',
10
- api_url: 'https://api.preview.platform.athenahealth.com',
11
- scope: 'athena/service/Athenanet.MDP.* system/Observation.read system/Patient.read',
12
- };
6
+ const mockData_1 = require("../../api/__mocks__/mockData");
7
+ jest.mock('../../api/client');
8
+ describe('athenahealth - Get appointment', () => {
13
9
  const onComplete = jest.fn();
14
10
  const onError = jest.fn();
11
+ beforeEach(() => {
12
+ jest.clearAllMocks();
13
+ });
15
14
  test('Should return an appointment', async () => {
16
15
  const mockOnActivityCreateParams = (0, tests_1.generateTestPayload)({
17
16
  fields: {
18
17
  appointmentId: '1',
19
- practiceId: '1',
18
+ practiceId: '195900',
20
19
  },
21
- settings,
20
+ settings: mockData_1.mockSettings,
22
21
  });
23
22
  await _1.getAppointment.onActivityCreated(mockOnActivityCreateParams, onComplete, onError);
24
23
  expect(onComplete).toHaveBeenCalledWith({
25
24
  data_points: {
26
- patientId: '56529',
27
- startTime: '1:00 PM',
28
- status: 'scheduled',
29
- type: 'Follow-up',
30
- date: '2024-05-05',
25
+ patientId: mockData_1.mockGetAppointmentResponse.patientid,
26
+ startTime: mockData_1.mockGetAppointmentResponse.starttime,
27
+ status: mockData_1.mockGetAppointmentResponse.appointmentstatus,
28
+ appointmentTypeName: mockData_1.mockGetAppointmentResponse.appointmenttype,
29
+ appointmentTypeId: mockData_1.mockGetAppointmentResponse.appointmenttypeid,
30
+ date: (0, date_fns_1.formatISO)(new Date(mockData_1.mockGetAppointmentResponse.date), {
31
+ representation: 'date',
32
+ }),
33
+ duration: String(mockData_1.mockGetAppointmentResponse.duration),
34
+ },
35
+ });
36
+ });
37
+ test('Should return an error when patient is not found', async () => {
38
+ var _a, _b;
39
+ const mockOnActivityCreateParams = (0, tests_1.generateTestPayload)({
40
+ fields: {
41
+ appointmentId: 'non-existent-appointment-id',
42
+ practiceId: '195900',
31
43
  },
44
+ settings: mockData_1.mockSettings,
32
45
  });
46
+ try {
47
+ await _1.getAppointment.onActivityCreated(mockOnActivityCreateParams, onComplete, onError);
48
+ }
49
+ catch (error) {
50
+ const axiosError = error;
51
+ expect(axiosError.response).toBeDefined();
52
+ expect((_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.status).toBe(404);
53
+ expect((_b = axiosError.response) === null || _b === void 0 ? void 0 : _b.data).toStrictEqual({
54
+ error: 'The appointment is not available.',
55
+ });
56
+ }
57
+ expect(onComplete).not.toHaveBeenCalled();
33
58
  });
34
59
  });
35
60
  //# sourceMappingURL=getAppointment.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getAppointment.test.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/actions/getAppointment/getAppointment.test.ts"],"names":[],"mappings":";;AAAA,wBAAkC;AAClC,iDAA2D;AAE3D,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,MAAM,QAAQ,GAAG;QACf,SAAS,EAAE,OAAO;QAClB,aAAa,EAAE,OAAO;QACtB,QAAQ,EAAE,+DAA+D;QACzE,OAAO,EAAE,+CAA+C;QACxD,KAAK,EACH,4EAA4E;KAC/E,CAAA;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEzB,IAAI,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,0BAA0B,GAAG,IAAA,2BAAmB,EAAC;YACrD,MAAM,EAAE;gBACN,aAAa,EAAE,GAAG;gBAClB,UAAU,EAAE,GAAG;aAChB;YACD,QAAQ;SACT,CAAC,CAAA;QAEF,MAAM,iBAAc,CAAC,iBAAiB,CACpC,0BAA0B,EAC1B,UAAU,EACV,OAAO,CACR,CAAA;QAED,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,WAAW,EAAE;gBACX,SAAS,EAAE,OAAO;gBAClB,SAAS,EAAE,SAAS;gBACpB,MAAM,EAAE,WAAW;gBACnB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,YAAY;aACnB;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"getAppointment.test.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/actions/getAppointment/getAppointment.test.ts"],"names":[],"mappings":";;AACA,uCAAoC;AACpC,wBAAkC;AAClC,iDAA2D;AAC3D,2DAAwF;AAExF,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;AAE7B,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC9C,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEzB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,0BAA0B,GAAG,IAAA,2BAAmB,EAAC;YACrD,MAAM,EAAE;gBACN,aAAa,EAAE,GAAG;gBAClB,UAAU,EAAE,QAAQ;aACrB;YACD,QAAQ,EAAE,uBAAY;SACvB,CAAC,CAAA;QAEF,MAAM,iBAAc,CAAC,iBAAiB,CACpC,0BAA0B,EAC1B,UAAU,EACV,OAAO,CACR,CAAA;QAED,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,WAAW,EAAE;gBACX,SAAS,EAAE,qCAA0B,CAAC,SAAS;gBAC/C,SAAS,EAAE,qCAA0B,CAAC,SAAS;gBAC/C,MAAM,EAAE,qCAA0B,CAAC,iBAAiB;gBACpD,mBAAmB,EAAE,qCAA0B,CAAC,eAAe;gBAC/D,iBAAiB,EAAE,qCAA0B,CAAC,iBAAiB;gBAC/D,IAAI,EAAE,IAAA,oBAAS,EAAC,IAAI,IAAI,CAAC,qCAA0B,CAAC,IAAI,CAAC,EAAE;oBACzD,cAAc,EAAE,MAAM;iBACvB,CAAC;gBACF,QAAQ,EAAE,MAAM,CAAC,qCAA0B,CAAC,QAAQ,CAAC;aACtD;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;;QAClE,MAAM,0BAA0B,GAAG,IAAA,2BAAmB,EAAC;YACrD,MAAM,EAAE;gBACN,aAAa,EAAE,6BAA6B;gBAC5C,UAAU,EAAE,QAAQ;aACrB;YACD,QAAQ,EAAE,uBAAY;SACvB,CAAC,CAAA;QAEF,IAAI;YACF,MAAM,iBAAc,CAAC,iBAAiB,CACpC,0BAA0B,EAC1B,UAAU,EACV,OAAO,CACR,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,UAAU,GAAG,KAAmB,CAAA;YACtC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;YACzC,MAAM,CAAC,MAAA,UAAU,CAAC,QAAQ,0CAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAC7C,MAAM,CAAC,MAAA,UAAU,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,aAAa,CAAC;gBAC9C,KAAK,EAAE,mCAAmC;aAC3C,CAAC,CAAA;SACH;QAED,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IAC3C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -4,6 +4,7 @@ exports.getPatient = void 0;
4
4
  const extensions_core_1 = require("@awell-health/extensions-core");
5
5
  const config_1 = require("./config");
6
6
  const helpers_1 = require("../../helpers");
7
+ const patient_1 = require("../../api/schema/patient");
7
8
  exports.getPatient = {
8
9
  key: 'getPatient',
9
10
  category: extensions_core_1.Category.EHR_INTEGRATIONS,
@@ -17,15 +18,15 @@ exports.getPatient = {
17
18
  fieldsSchema: config_1.FieldsValidationSchema,
18
19
  payload,
19
20
  });
20
- console.log(input, client);
21
- // Client doesn't work yet :-(
22
- // await client.getPatient(input)
21
+ const res = await client.getPatient(input);
22
+ // Both validates and transforms some of the response data
23
+ const patient = patient_1.PatientSchema.parse(res);
23
24
  await onComplete({
24
25
  data_points: {
25
- firstName: 'Rik',
26
- lastName: 'Renard',
27
- dob: '1993-11-30',
28
- email: 'rik@awellhealth.com',
26
+ firstName: patient.firstname,
27
+ lastName: patient.lastname,
28
+ dob: patient.dob,
29
+ email: patient.email,
29
30
  },
30
31
  });
31
32
  },
@@ -1 +1 @@
1
- {"version":3,"file":"getPatient.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/actions/getPatient/getPatient.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,2CAA8D;AAEjD,QAAA,UAAU,GAInB;IACF,GAAG,EAAE,YAAY;IACjB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,sCAAsC;IACnD,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,EAAE;QACvE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,wCAA8B,EAAC;YACrE,YAAY,EAAE,+BAAsB;YACpC,OAAO;SACR,CAAC,CAAA;QAEF,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAE1B,8BAA8B;QAC9B,iCAAiC;QAEjC,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,qBAAqB;aAC7B;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"getPatient.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/actions/getPatient/getPatient.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,2CAA8D;AAC9D,sDAAwD;AAE3C,QAAA,UAAU,GAInB;IACF,GAAG,EAAE,YAAY;IACjB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,sCAAsC;IACnD,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,EAAE;QACvE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,wCAA8B,EAAC;YACrE,YAAY,EAAE,+BAAsB;YACpC,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QAE1C,0DAA0D;QAC1D,MAAM,OAAO,GAAG,uBAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAExC,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
@@ -2,33 +2,56 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const _1 = require(".");
4
4
  const tests_1 = require("../../../../src/tests");
5
- describe('Athena - Get patient', () => {
6
- const settings = {
7
- client_id: 'hello',
8
- client_secret: 'world',
9
- auth_url: 'https://api.preview.platform.athenahealth.com/oauth2/v1/token',
10
- api_url: 'https://api.preview.platform.athenahealth.com',
11
- scope: 'athena/service/Athenanet.MDP.* system/Observation.read system/Patient.read',
12
- };
5
+ const mockData_1 = require("../../api/__mocks__/mockData");
6
+ const date_fns_1 = require("date-fns");
7
+ jest.mock('../../api/client');
8
+ describe('athenahealth - Get patient', () => {
13
9
  const onComplete = jest.fn();
14
10
  const onError = jest.fn();
11
+ beforeEach(() => {
12
+ jest.clearAllMocks();
13
+ });
15
14
  test('Should return a patient', async () => {
16
15
  const mockOnActivityCreateParams = (0, tests_1.generateTestPayload)({
17
16
  fields: {
18
- patientId: '1',
19
- practiceId: '1',
17
+ patientId: '56529',
18
+ practiceId: '195900',
20
19
  },
21
- settings,
20
+ settings: mockData_1.mockSettings,
22
21
  });
23
22
  await _1.getPatient.onActivityCreated(mockOnActivityCreateParams, onComplete, onError);
24
23
  expect(onComplete).toHaveBeenCalledWith({
25
24
  data_points: {
26
- firstName: 'Rik',
27
- lastName: 'Renard',
28
- dob: '1993-11-30',
29
- email: 'rik@awellhealth.com',
25
+ firstName: mockData_1.mockGetPatientResponse.firstname,
26
+ lastName: mockData_1.mockGetPatientResponse.lastname,
27
+ dob: (0, date_fns_1.formatISO)(new Date(mockData_1.mockGetPatientResponse.dob), {
28
+ representation: 'date',
29
+ }),
30
+ email: mockData_1.mockGetPatientResponse.email,
31
+ },
32
+ });
33
+ });
34
+ test('Should return an error when patient is not found', async () => {
35
+ var _a, _b;
36
+ const mockOnActivityCreateParams = (0, tests_1.generateTestPayload)({
37
+ fields: {
38
+ patientId: 'non-existent-patient-id',
39
+ practiceId: '195900',
30
40
  },
41
+ settings: mockData_1.mockSettings,
31
42
  });
43
+ try {
44
+ await _1.getPatient.onActivityCreated(mockOnActivityCreateParams, onComplete, onError);
45
+ }
46
+ catch (error) {
47
+ const axiosError = error;
48
+ expect(axiosError.response).toBeDefined();
49
+ expect((_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.status).toBe(404);
50
+ expect((_b = axiosError.response) === null || _b === void 0 ? void 0 : _b.data).toStrictEqual({
51
+ error: 'This patient does not exist in this context.',
52
+ });
53
+ }
54
+ expect(onComplete).not.toHaveBeenCalled();
32
55
  });
33
56
  });
34
57
  //# sourceMappingURL=getPatient.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPatient.test.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/actions/getPatient/getPatient.test.ts"],"names":[],"mappings":";;AAAA,wBAA8B;AAC9B,iDAA2D;AAE3D,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,MAAM,QAAQ,GAAG;QACf,SAAS,EAAE,OAAO;QAClB,aAAa,EAAE,OAAO;QACtB,QAAQ,EAAE,+DAA+D;QACzE,OAAO,EAAE,+CAA+C;QACxD,KAAK,EACH,4EAA4E;KAC/E,CAAA;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEzB,IAAI,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,0BAA0B,GAAG,IAAA,2BAAmB,EAAC;YACrD,MAAM,EAAE;gBACN,SAAS,EAAE,GAAG;gBACd,UAAU,EAAE,GAAG;aAChB;YACD,QAAQ;SACT,CAAC,CAAA;QAEF,MAAM,aAAU,CAAC,iBAAiB,CAChC,0BAA0B,EAC1B,UAAU,EACV,OAAO,CACR,CAAA;QAED,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,WAAW,EAAE;gBACX,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,qBAAqB;aAC7B;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"getPatient.test.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/actions/getPatient/getPatient.test.ts"],"names":[],"mappings":";;AAAA,wBAA8B;AAC9B,iDAA2D;AAE3D,2DAGqC;AACrC,uCAAoC;AAEpC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;AAE7B,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEzB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,0BAA0B,GAAG,IAAA,2BAAmB,EAAC;YACrD,MAAM,EAAE;gBACN,SAAS,EAAE,OAAO;gBAClB,UAAU,EAAE,QAAQ;aACrB;YACD,QAAQ,EAAE,uBAAY;SACvB,CAAC,CAAA;QAEF,MAAM,aAAU,CAAC,iBAAiB,CAChC,0BAA0B,EAC1B,UAAU,EACV,OAAO,CACR,CAAA;QAED,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,WAAW,EAAE;gBACX,SAAS,EAAE,iCAAsB,CAAC,SAAS;gBAC3C,QAAQ,EAAE,iCAAsB,CAAC,QAAQ;gBACzC,GAAG,EAAE,IAAA,oBAAS,EAAC,IAAI,IAAI,CAAC,iCAAsB,CAAC,GAAG,CAAC,EAAE;oBACnD,cAAc,EAAE,MAAM;iBACvB,CAAC;gBACF,KAAK,EAAE,iCAAsB,CAAC,KAAK;aACpC;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;;QAClE,MAAM,0BAA0B,GAAG,IAAA,2BAAmB,EAAC;YACrD,MAAM,EAAE;gBACN,SAAS,EAAE,yBAAyB;gBACpC,UAAU,EAAE,QAAQ;aACrB;YACD,QAAQ,EAAE,uBAAY;SACvB,CAAC,CAAA;QAEF,IAAI;YACF,MAAM,aAAU,CAAC,iBAAiB,CAChC,0BAA0B,EAC1B,UAAU,EACV,OAAO,CACR,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,UAAU,GAAG,KAAmB,CAAA;YACtC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;YACzC,MAAM,CAAC,MAAA,UAAU,CAAC,QAAQ,0CAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAC7C,MAAM,CAAC,MAAA,UAAU,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,aAAa,CAAC;gBAC9C,KAAK,EAAE,8CAA8C;aACtD,CAAC,CAAA;SACH;QAED,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IAC3C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -102,86 +102,48 @@ declare const actions: {
102
102
  required: true;
103
103
  description: string;
104
104
  };
105
- }, "type" | "startTime" | "status" | "date" | "patientId", never>;
106
- cancelAppointment: import("@awell-health/extensions-core").Action<{
107
- appointmentId: {
105
+ }, "startTime" | "status" | "date" | "patientId" | "duration" | "appointmentTypeId" | "appointmentTypeName", never>;
106
+ createPatient: import("@awell-health/extensions-core").Action<{
107
+ practiceid: {
108
108
  id: string;
109
109
  label: string;
110
110
  description: string;
111
111
  type: import("@awell-health/extensions-core").FieldType.STRING;
112
112
  required: true;
113
113
  };
114
- practiceId: {
114
+ departmentid: {
115
115
  id: string;
116
116
  label: string;
117
117
  description: string;
118
118
  type: import("@awell-health/extensions-core").FieldType.STRING;
119
119
  required: true;
120
120
  };
121
- }, {
122
- auth_url: {
123
- key: string;
124
- label: string;
125
- obfuscated: false;
126
- required: true;
127
- description: string;
128
- };
129
- client_id: {
130
- key: string;
131
- label: string;
132
- obfuscated: true;
133
- required: true;
134
- description: string;
135
- };
136
- client_secret: {
137
- key: string;
138
- label: string;
139
- obfuscated: true;
140
- required: true;
141
- description: string;
142
- };
143
- api_url: {
144
- key: string;
145
- label: string;
146
- obfuscated: false;
147
- required: true;
148
- description: string;
149
- };
150
- scope: {
151
- key: string;
152
- label: string;
153
- obfuscated: false;
154
- required: true;
155
- description: string;
156
- };
157
- }, never, never>;
158
- addProblemToPatientChart: import("@awell-health/extensions-core").Action<{
159
- patientId: {
121
+ firstname: {
160
122
  id: string;
161
123
  label: string;
162
124
  description: string;
163
125
  type: import("@awell-health/extensions-core").FieldType.STRING;
164
126
  required: true;
165
127
  };
166
- practiceId: {
128
+ lastname: {
167
129
  id: string;
168
130
  label: string;
169
131
  description: string;
170
132
  type: import("@awell-health/extensions-core").FieldType.STRING;
171
133
  required: true;
172
134
  };
173
- note: {
135
+ dob: {
174
136
  id: string;
175
137
  label: string;
176
138
  description: string;
177
- type: import("@awell-health/extensions-core").FieldType.TEXT;
139
+ type: import("@awell-health/extensions-core").FieldType.DATE;
178
140
  required: true;
179
141
  };
180
- onsetDate: {
142
+ email: {
181
143
  id: string;
182
144
  label: string;
183
145
  description: string;
184
- type: import("@awell-health/extensions-core").FieldType.DATE;
146
+ type: import("@awell-health/extensions-core").FieldType.STRING;
185
147
  required: true;
186
148
  };
187
149
  }, {
@@ -220,49 +182,35 @@ declare const actions: {
220
182
  required: true;
221
183
  description: string;
222
184
  };
223
- }, never, never>;
224
- addDocumentToPatientChart: import("@awell-health/extensions-core").Action<{
225
- patientId: {
185
+ }, "createdPatientId", never>;
186
+ createAppointmentNote: import("@awell-health/extensions-core").Action<{
187
+ practiceid: {
226
188
  id: string;
227
189
  label: string;
228
190
  description: string;
229
191
  type: import("@awell-health/extensions-core").FieldType.STRING;
230
192
  required: true;
231
193
  };
232
- practiceId: {
194
+ appointmentid: {
233
195
  id: string;
234
196
  label: string;
235
197
  description: string;
236
198
  type: import("@awell-health/extensions-core").FieldType.STRING;
237
199
  required: true;
238
200
  };
239
- departmentId: {
201
+ notetext: {
240
202
  id: string;
241
203
  label: string;
242
204
  description: string;
243
- type: import("@awell-health/extensions-core").FieldType.STRING;
244
- required: true;
245
- };
246
- actionNote: {
247
- id: string;
248
- label: string;
249
- description: string;
250
- type: import("@awell-health/extensions-core").FieldType.STRING;
251
- required: false;
252
- };
253
- documentContent: {
254
- id: string;
255
- label: string;
256
- description: string;
257
- type: import("@awell-health/extensions-core").FieldType.HTML;
205
+ type: import("@awell-health/extensions-core").FieldType.TEXT;
258
206
  required: true;
259
207
  };
260
- autoClose: {
208
+ displayonschedule: {
261
209
  id: string;
262
210
  label: string;
263
211
  description: string;
264
212
  type: import("@awell-health/extensions-core").FieldType.BOOLEAN;
265
- required: true;
213
+ required: false;
266
214
  };
267
215
  }, {
268
216
  auth_url: {
@@ -2,15 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const getPatient_1 = require("./getPatient");
4
4
  const getAppointment_1 = require("./getAppointment");
5
- const cancelAppointment_1 = require("./cancelAppointment");
6
- const addProblemToPatientChart_1 = require("./addProblemToPatientChart");
7
- const addDocumentToPatientChart_1 = require("./addDocumentToPatientChart");
5
+ const createPatient_1 = require("./createPatient");
6
+ const createAppointmentNote_1 = require("./createAppointmentNote");
7
+ // import { addProblemToPatientChart } from './addProblemToPatientChart'
8
+ // import { addDocumentToPatientChart } from './addDocumentToPatientChart'
8
9
  const actions = {
9
10
  getPatient: getPatient_1.getPatient,
10
11
  getAppointment: getAppointment_1.getAppointment,
11
- cancelAppointment: cancelAppointment_1.cancelAppointment,
12
- addProblemToPatientChart: addProblemToPatientChart_1.addProblemToPatientChart,
13
- addDocumentToPatientChart: addDocumentToPatientChart_1.addDocumentToPatientChart,
12
+ createPatient: createPatient_1.createPatient,
13
+ createAppointmentNote: createAppointmentNote_1.createAppointmentNote,
14
+ // addProblemToPatientChart,
15
+ // addDocumentToPatientChart,
14
16
  };
15
17
  exports.default = actions;
16
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/athenahealth/actions/index.ts"],"names":[],"mappings":";;AAAA,6CAAyC;AACzC,qDAAiD;AACjD,2DAAuD;AACvD,yEAAqE;AACrE,2EAAuE;AAEvE,MAAM,OAAO,GAAG;IACd,UAAU,EAAV,uBAAU;IACV,cAAc,EAAd,+BAAc;IACd,iBAAiB,EAAjB,qCAAiB;IACjB,wBAAwB,EAAxB,mDAAwB;IACxB,yBAAyB,EAAzB,qDAAyB;CAC1B,CAAA;AAED,kBAAe,OAAO,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/athenahealth/actions/index.ts"],"names":[],"mappings":";;AAAA,6CAAyC;AACzC,qDAAiD;AACjD,mDAA+C;AAC/C,mEAA+D;AAC/D,wEAAwE;AACxE,0EAA0E;AAE1E,MAAM,OAAO,GAAG;IACd,UAAU,EAAV,uBAAU;IACV,cAAc,EAAd,+BAAc;IACd,aAAa,EAAb,6BAAa;IACb,qBAAqB,EAArB,6CAAqB;IACrB,4BAA4B;IAC5B,6BAA6B;CAC9B,CAAA;AAED,kBAAe,OAAO,CAAA"}
@@ -1,9 +1,26 @@
1
1
  import { APIClient, DataWrapper, type DataWrapperCtor, type OAuthGrantClientCredentialsRequest } from '@awell-health/extensions-core';
2
+ import { type CreateAppointmentNoteInputType } from '../actions/createAppointmentNote/config/fields';
3
+ import { type CreatePatientInputType } from '../actions/createPatient/config/fields';
4
+ import { type PatientSchemaType, type AppointmentSchemaType } from './schema';
5
+ import { type CreatePatientResponseType } from './schema/patient';
2
6
  export declare class AthenaDataWrapper extends DataWrapper {
7
+ createPatient({ practiceId, data, }: {
8
+ practiceId: string;
9
+ data: Omit<CreatePatientInputType, 'practiceid'>;
10
+ }): Promise<CreatePatientResponseType>;
3
11
  getPatient({ practiceId, patientId, }: {
4
12
  practiceId: string;
5
13
  patientId: string;
6
- }): Promise<any>;
14
+ }): Promise<PatientSchemaType>;
15
+ getAppointment({ practiceId, appointmentId, }: {
16
+ practiceId: string;
17
+ appointmentId: string;
18
+ }): Promise<AppointmentSchemaType>;
19
+ createAppointmentNote({ practiceId, appointmentId, data, }: {
20
+ practiceId: string;
21
+ appointmentId: string;
22
+ data: Omit<CreateAppointmentNoteInputType, 'practiceid' | 'appointmentid'>;
23
+ }): Promise<CreatePatientResponseType>;
7
24
  }
8
25
  interface AthenaClientConstructorProps {
9
26
  authUrl: string;
@@ -13,9 +30,22 @@ interface AthenaClientConstructorProps {
13
30
  export declare class AthenaAPIClient extends APIClient<AthenaDataWrapper> {
14
31
  readonly ctor: DataWrapperCtor<AthenaDataWrapper>;
15
32
  constructor({ authUrl, requestConfig, ...opts }: AthenaClientConstructorProps);
33
+ createPatient({ practiceId, data, }: {
34
+ practiceId: string;
35
+ data: Omit<CreatePatientInputType, 'practiceid'>;
36
+ }): Promise<CreatePatientResponseType>;
16
37
  getPatient({ practiceId, patientId, }: {
17
38
  practiceId: string;
18
39
  patientId: string;
19
- }): Promise<any>;
40
+ }): Promise<PatientSchemaType>;
41
+ getAppointment({ practiceId, appointmentId, }: {
42
+ practiceId: string;
43
+ appointmentId: string;
44
+ }): Promise<AppointmentSchemaType>;
45
+ createAppointmentNote({ practiceId, appointmentId, data, }: {
46
+ practiceId: string;
47
+ appointmentId: string;
48
+ data: Omit<CreateAppointmentNoteInputType, 'practiceid' | 'appointmentid'>;
49
+ }): Promise<CreatePatientResponseType>;
20
50
  }
21
51
  export {};
@@ -2,12 +2,39 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AthenaAPIClient = exports.AthenaDataWrapper = void 0;
4
4
  const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const cacheService_1 = require("./cacheService");
5
6
  class AthenaDataWrapper extends extensions_core_1.DataWrapper {
7
+ async createPatient({ practiceId, data, }) {
8
+ const result = await this.Request({
9
+ method: 'POST',
10
+ url: `/v1/${practiceId}/patients`,
11
+ headers: { 'content-type': 'application/x-www-form-urlencoded' },
12
+ data,
13
+ });
14
+ return result[0];
15
+ }
6
16
  async getPatient({ practiceId, patientId, }) {
7
- return await this.Request({
17
+ const result = await this.Request({
8
18
  method: 'GET',
9
19
  url: `/v1/${practiceId}/patients/${patientId}`,
10
20
  });
21
+ return result[0];
22
+ }
23
+ async getAppointment({ practiceId, appointmentId, }) {
24
+ const result = await this.Request({
25
+ method: 'GET',
26
+ url: `/v1/${practiceId}/appointments/${appointmentId}`,
27
+ });
28
+ return result[0];
29
+ }
30
+ async createAppointmentNote({ practiceId, appointmentId, data, }) {
31
+ const result = await this.Request({
32
+ method: 'POST',
33
+ url: `/v1/${practiceId}/appointments/${appointmentId}/notes`,
34
+ headers: { 'content-type': 'application/x-www-form-urlencoded' },
35
+ data,
36
+ });
37
+ return result[0];
11
38
  }
12
39
  }
13
40
  exports.AthenaDataWrapper = AthenaDataWrapper;
@@ -18,14 +45,23 @@ class AthenaAPIClient extends extensions_core_1.APIClient {
18
45
  auth: new extensions_core_1.OAuthClientCredentials({
19
46
  auth_url: authUrl,
20
47
  request_config: requestConfig,
48
+ cacheService: cacheService_1.cacheService,
21
49
  }),
22
50
  });
23
51
  this.ctor = (token, baseUrl) => new AthenaDataWrapper(token, baseUrl);
24
52
  }
53
+ async createPatient({ practiceId, data, }) {
54
+ return await this.FetchData(async (dw) => await dw.createPatient({ practiceId, data }));
55
+ }
25
56
  async getPatient({ practiceId, patientId, }) {
26
- /** FetchData returns a 404 */
27
57
  return await this.FetchData(async (dw) => await dw.getPatient({ patientId, practiceId }));
28
58
  }
59
+ async getAppointment({ practiceId, appointmentId, }) {
60
+ return await this.FetchData(async (dw) => await dw.getAppointment({ appointmentId, practiceId }));
61
+ }
62
+ async createAppointmentNote({ practiceId, appointmentId, data, }) {
63
+ return await this.FetchData(async (dw) => await dw.createAppointmentNote({ appointmentId, practiceId, data }));
64
+ }
29
65
  }
30
66
  exports.AthenaAPIClient = AthenaAPIClient;
31
67
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../extensions/athenahealth/api/client.ts"],"names":[],"mappings":";;;AAAA,mEAK+E;AAE/E,MAAa,iBAAkB,SAAQ,6BAAW;IACzC,KAAK,CAAC,UAAU,CAAC,EACtB,UAAU,EACV,SAAS,GAIV;QACC,OAAO,MAAM,IAAI,CAAC,OAAO,CAAM;YAC7B,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,OAAO,UAAU,aAAa,SAAS,EAAE;SAC/C,CAAC,CAAA;IACJ,CAAC;CACF;AAbD,8CAaC;AAQD,MAAa,eAAgB,SAAQ,2BAA4B;IAM/D,YAAmB,EACjB,OAAO,EACP,aAAa,EACb,GAAG,IAAI,EACsB;QAC7B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,IAAI,EAAE,IAAI,wCAAsB,CAAC;gBAC/B,QAAQ,EAAE,OAAO;gBACjB,cAAc,EAAE,aAAa;aAC9B,CAAC;SACH,CAAC,CAAA;QAhBK,SAAI,GAAuC,CAClD,KAAa,EACb,OAAe,EACf,EAAE,CAAC,IAAI,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAc1C,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,EACtB,UAAU,EACV,SAAS,GAIV;QACC,8BAA8B;QAC9B,OAAO,MAAM,IAAI,CAAC,SAAS,CACzB,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAC7D,CAAA;IACH,CAAC;CACF;AAhCD,0CAgCC"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../extensions/athenahealth/api/client.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,36 @@
1
+ import z from 'zod';
2
+ export declare const AppointmentSchema: z.ZodObject<{
3
+ appointmenttypeid: z.ZodString;
4
+ appointmenttype: z.ZodString;
5
+ patientappointmenttypename: z.ZodString;
6
+ appointmentstatus: z.ZodString;
7
+ departmentid: z.ZodString;
8
+ providerid: z.ZodString;
9
+ date: z.ZodEffects<z.ZodString, string, string>;
10
+ patientid: z.ZodString;
11
+ duration: z.ZodNumber;
12
+ starttime: z.ZodString;
13
+ }, "strip", z.ZodTypeAny, {
14
+ date: string;
15
+ duration: number;
16
+ departmentid: string;
17
+ appointmenttypeid: string;
18
+ appointmenttype: string;
19
+ patientappointmenttypename: string;
20
+ appointmentstatus: string;
21
+ providerid: string;
22
+ patientid: string;
23
+ starttime: string;
24
+ }, {
25
+ date: string;
26
+ duration: number;
27
+ departmentid: string;
28
+ appointmenttypeid: string;
29
+ appointmenttype: string;
30
+ patientappointmenttypename: string;
31
+ appointmentstatus: string;
32
+ providerid: string;
33
+ patientid: string;
34
+ starttime: string;
35
+ }>;
36
+ export type AppointmentSchemaType = z.infer<typeof AppointmentSchema>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AppointmentSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const date_1 = require("./date");
9
+ exports.AppointmentSchema = zod_1.default.object({
10
+ appointmenttypeid: zod_1.default.string(),
11
+ appointmenttype: zod_1.default.string(),
12
+ patientappointmenttypename: zod_1.default.string(),
13
+ appointmentstatus: zod_1.default.string(),
14
+ departmentid: zod_1.default.string(),
15
+ providerid: zod_1.default.string(),
16
+ date: date_1.AthenaDateOnlySchema,
17
+ patientid: zod_1.default.string(),
18
+ duration: zod_1.default.number(),
19
+ starttime: zod_1.default.string(),
20
+ });
21
+ //# sourceMappingURL=appointment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appointment.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/api/schema/appointment.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAmB;AACnB,iCAA6C;AAEhC,QAAA,iBAAiB,GAAG,aAAC,CAAC,MAAM,CAAC;IACxC,iBAAiB,EAAE,aAAC,CAAC,MAAM,EAAE;IAC7B,eAAe,EAAE,aAAC,CAAC,MAAM,EAAE;IAC3B,0BAA0B,EAAE,aAAC,CAAC,MAAM,EAAE;IACtC,iBAAiB,EAAE,aAAC,CAAC,MAAM,EAAE;IAC7B,YAAY,EAAE,aAAC,CAAC,MAAM,EAAE;IACxB,UAAU,EAAE,aAAC,CAAC,MAAM,EAAE;IACtB,IAAI,EAAE,2BAAoB;IAC1B,SAAS,EAAE,aAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,aAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Athena dates are in MM/DD/YYYY
4
+ * We transform it to ISO date format
5
+ */
6
+ export declare const AthenaDateOnlySchema: z.ZodEffects<z.ZodString, string, string>;
7
+ export declare const AthenaDateOnlyOptionalSchema: z.ZodUnion<[z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AthenaDateOnlyOptionalSchema = exports.AthenaDateOnlySchema = void 0;
4
+ const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const date_fns_1 = require("date-fns");
6
+ const zod_1 = require("zod");
7
+ /**
8
+ * Athena dates are in MM/DD/YYYY
9
+ * We transform it to ISO date format
10
+ */
11
+ exports.AthenaDateOnlySchema = zod_1.z.string().transform((arg, ctx) => {
12
+ const date = new Date(arg);
13
+ if (!(0, date_fns_1.isValid)(date)) {
14
+ ctx.addIssue({
15
+ code: zod_1.z.ZodIssueCode.invalid_date,
16
+ message: 'Not able to parse athena date',
17
+ });
18
+ return zod_1.z.NEVER;
19
+ }
20
+ return (0, date_fns_1.formatISO)(date, { representation: 'date' });
21
+ });
22
+ exports.AthenaDateOnlyOptionalSchema = (0, extensions_core_1.makeStringOptional)(exports.AthenaDateOnlySchema);
23
+ //# sourceMappingURL=date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/api/schema/date.ts"],"names":[],"mappings":";;;AAAA,mEAAkE;AAClE,uCAA6C;AAC7C,6BAAuB;AAEvB;;;GAGG;AACU,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACpE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAA;IAE1B,IAAI,CAAC,IAAA,kBAAO,EAAC,IAAI,CAAC,EAAE;QAClB,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,YAAY;YACjC,OAAO,EAAE,+BAA+B;SACzC,CAAC,CAAA;QACF,OAAO,OAAC,CAAC,KAAK,CAAA;KACf;IAED,OAAO,IAAA,oBAAS,EAAC,IAAI,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAA;AACpD,CAAC,CAAC,CAAA;AAEW,QAAA,4BAA4B,GACvC,IAAA,oCAAkB,EAAC,4BAAoB,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { type AppointmentSchemaType, AppointmentSchema } from './appointment';
2
+ export { AthenaDateOnlyOptionalSchema, AthenaDateOnlySchema } from './date';
3
+ export { type PatientSchemaType, PatientSchema } from './patient';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PatientSchema = exports.AthenaDateOnlySchema = exports.AthenaDateOnlyOptionalSchema = exports.AppointmentSchema = void 0;
4
+ var appointment_1 = require("./appointment");
5
+ Object.defineProperty(exports, "AppointmentSchema", { enumerable: true, get: function () { return appointment_1.AppointmentSchema; } });
6
+ var date_1 = require("./date");
7
+ Object.defineProperty(exports, "AthenaDateOnlyOptionalSchema", { enumerable: true, get: function () { return date_1.AthenaDateOnlyOptionalSchema; } });
8
+ Object.defineProperty(exports, "AthenaDateOnlySchema", { enumerable: true, get: function () { return date_1.AthenaDateOnlySchema; } });
9
+ var patient_1 = require("./patient");
10
+ Object.defineProperty(exports, "PatientSchema", { enumerable: true, get: function () { return patient_1.PatientSchema; } });
11
+ //# sourceMappingURL=index.js.map