@awell-health/awell-extensions 1.0.214 → 1.0.216

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. package/dist/extensions/athenahealth/actions/createAppointmentNote/config/datapoints.js.map +1 -0
  2. package/dist/extensions/athenahealth/actions/createAppointmentNote/config/fields.d.ts +39 -0
  3. package/dist/extensions/athenahealth/actions/{cancelAppointment → createAppointmentNote}/config/fields.js +16 -8
  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/createAppointmentNote/createAppointmentNote.js +29 -0
  8. package/dist/extensions/athenahealth/actions/createAppointmentNote/createAppointmentNote.js.map +1 -0
  9. package/dist/extensions/athenahealth/actions/createAppointmentNote/createAppointmentNote.test.js +73 -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/{addDocumentToPatientChart → createPatient}/config/fields.d.ts +23 -32
  18. package/dist/extensions/athenahealth/actions/createPatient/config/fields.js +54 -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/createPatient/createPatient.js +31 -0
  23. package/dist/extensions/athenahealth/actions/createPatient/createPatient.js.map +1 -0
  24. package/dist/extensions/athenahealth/actions/createPatient/createPatient.test.js +32 -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 +10 -2
  31. package/dist/extensions/athenahealth/actions/getAppointment/config/datapoints.js.map +1 -1
  32. package/dist/extensions/athenahealth/actions/getAppointment/config/fields.d.ts +0 -10
  33. package/dist/extensions/athenahealth/actions/getAppointment/config/fields.js +0 -8
  34. package/dist/extensions/athenahealth/actions/getAppointment/config/fields.js.map +1 -1
  35. package/dist/extensions/athenahealth/actions/getAppointment/getAppointment.js +12 -7
  36. package/dist/extensions/athenahealth/actions/getAppointment/getAppointment.js.map +1 -1
  37. package/dist/extensions/athenahealth/actions/getAppointment/getAppointment.test.js +60 -15
  38. package/dist/extensions/athenahealth/actions/getAppointment/getAppointment.test.js.map +1 -1
  39. package/dist/extensions/athenahealth/actions/getPatient/config/fields.d.ts +0 -10
  40. package/dist/extensions/athenahealth/actions/getPatient/config/fields.js +0 -8
  41. package/dist/extensions/athenahealth/actions/getPatient/config/fields.js.map +1 -1
  42. package/dist/extensions/athenahealth/actions/getPatient/getPatient.js +9 -8
  43. package/dist/extensions/athenahealth/actions/getPatient/getPatient.js.map +1 -1
  44. package/dist/extensions/athenahealth/actions/getPatient/getPatient.test.js +58 -15
  45. package/dist/extensions/athenahealth/actions/getPatient/getPatient.test.js.map +1 -1
  46. package/dist/extensions/athenahealth/actions/index.d.ts +35 -87
  47. package/dist/extensions/athenahealth/actions/index.js +4 -6
  48. package/dist/extensions/athenahealth/actions/index.js.map +1 -1
  49. package/dist/extensions/athenahealth/api/client.d.ts +32 -2
  50. package/dist/extensions/athenahealth/api/client.js +38 -2
  51. package/dist/extensions/athenahealth/api/client.js.map +1 -1
  52. package/dist/extensions/athenahealth/api/schema/appointment.d.ts +36 -0
  53. package/dist/extensions/athenahealth/api/schema/appointment.js +21 -0
  54. package/dist/extensions/athenahealth/api/schema/appointment.js.map +1 -0
  55. package/dist/extensions/athenahealth/api/schema/date.d.ts +7 -0
  56. package/dist/extensions/athenahealth/api/schema/date.js +23 -0
  57. package/dist/extensions/athenahealth/api/schema/date.js.map +1 -0
  58. package/dist/extensions/athenahealth/api/schema/index.d.ts +3 -0
  59. package/dist/extensions/athenahealth/api/schema/index.js +11 -0
  60. package/dist/extensions/athenahealth/api/schema/index.js.map +1 -0
  61. package/dist/extensions/athenahealth/api/schema/patient.d.ts +42 -0
  62. package/dist/extensions/athenahealth/api/schema/patient.js +22 -0
  63. package/dist/extensions/athenahealth/api/schema/patient.js.map +1 -0
  64. package/dist/extensions/athenahealth/api/schema/schema.test.js +22 -0
  65. package/dist/extensions/athenahealth/api/schema/schema.test.js.map +1 -0
  66. package/dist/extensions/athenahealth/helpers.d.ts +2 -0
  67. package/dist/extensions/athenahealth/helpers.js +2 -2
  68. package/dist/extensions/athenahealth/helpers.js.map +1 -1
  69. package/dist/extensions/athenahealth/settings.d.ts +10 -0
  70. package/dist/extensions/athenahealth/settings.js +11 -3
  71. package/dist/extensions/athenahealth/settings.js.map +1 -1
  72. package/dist/extensions/athenahealth/validation/date.d.ts +6 -0
  73. package/dist/extensions/athenahealth/validation/date.js +22 -0
  74. package/dist/extensions/athenahealth/validation/date.js.map +1 -0
  75. package/dist/extensions/athenahealth/validation/validation.test.d.ts +1 -0
  76. package/dist/extensions/athenahealth/validation/validation.test.js +12 -0
  77. package/dist/extensions/athenahealth/validation/validation.test.js.map +1 -0
  78. package/dist/extensions/markdown.json +1 -1
  79. package/package.json +1 -1
  80. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/addDocumentToPatientChart.d.ts +0 -4
  81. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/addDocumentToPatientChart.js +0 -24
  82. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/addDocumentToPatientChart.js.map +0 -1
  83. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/addDocumentToPatientChart.test.js +0 -31
  84. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/addDocumentToPatientChart.test.js.map +0 -1
  85. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/config/datapoints.js.map +0 -1
  86. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/config/fields.js +0 -61
  87. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/config/fields.js.map +0 -1
  88. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/config/index.js.map +0 -1
  89. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/index.d.ts +0 -1
  90. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/index.js +0 -6
  91. package/dist/extensions/athenahealth/actions/addDocumentToPatientChart/index.js.map +0 -1
  92. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/addProblemToPatientChart.js +0 -24
  93. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/addProblemToPatientChart.js.map +0 -1
  94. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/addProblemToPatientChart.test.js +0 -29
  95. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/addProblemToPatientChart.test.js.map +0 -1
  96. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/config/datapoints.d.ts +0 -1
  97. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/config/datapoints.js +0 -5
  98. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/config/datapoints.js.map +0 -1
  99. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/config/fields.d.ts +0 -48
  100. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/config/fields.js +0 -45
  101. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/config/fields.js.map +0 -1
  102. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/config/index.js.map +0 -1
  103. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/index.d.ts +0 -1
  104. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/index.js +0 -6
  105. package/dist/extensions/athenahealth/actions/addProblemToPatientChart/index.js.map +0 -1
  106. package/dist/extensions/athenahealth/actions/cancelAppointment/cancelAppointment.js +0 -24
  107. package/dist/extensions/athenahealth/actions/cancelAppointment/cancelAppointment.js.map +0 -1
  108. package/dist/extensions/athenahealth/actions/cancelAppointment/cancelAppointment.test.js +0 -27
  109. package/dist/extensions/athenahealth/actions/cancelAppointment/cancelAppointment.test.js.map +0 -1
  110. package/dist/extensions/athenahealth/actions/cancelAppointment/config/datapoints.d.ts +0 -1
  111. package/dist/extensions/athenahealth/actions/cancelAppointment/config/datapoints.js +0 -5
  112. package/dist/extensions/athenahealth/actions/cancelAppointment/config/datapoints.js.map +0 -1
  113. package/dist/extensions/athenahealth/actions/cancelAppointment/config/fields.d.ts +0 -28
  114. package/dist/extensions/athenahealth/actions/cancelAppointment/config/fields.js.map +0 -1
  115. package/dist/extensions/athenahealth/actions/cancelAppointment/config/index.d.ts +0 -2
  116. package/dist/extensions/athenahealth/actions/cancelAppointment/config/index.js +0 -9
  117. package/dist/extensions/athenahealth/actions/cancelAppointment/config/index.js.map +0 -1
  118. package/dist/extensions/athenahealth/actions/cancelAppointment/index.d.ts +0 -1
  119. package/dist/extensions/athenahealth/actions/cancelAppointment/index.js +0 -6
  120. package/dist/extensions/athenahealth/actions/cancelAppointment/index.js.map +0 -1
  121. /package/dist/extensions/athenahealth/actions/{addDocumentToPatientChart → createAppointmentNote}/config/datapoints.d.ts +0 -0
  122. /package/dist/extensions/athenahealth/actions/{addDocumentToPatientChart → createAppointmentNote}/config/datapoints.js +0 -0
  123. /package/dist/extensions/athenahealth/actions/{addDocumentToPatientChart → createAppointmentNote}/config/index.d.ts +0 -0
  124. /package/dist/extensions/athenahealth/actions/{addDocumentToPatientChart → createAppointmentNote}/config/index.js +0 -0
  125. /package/dist/extensions/athenahealth/actions/{addDocumentToPatientChart/addDocumentToPatientChart.test.d.ts → createAppointmentNote/createAppointmentNote.test.d.ts} +0 -0
  126. /package/dist/extensions/athenahealth/actions/{addProblemToPatientChart → createPatient}/config/index.d.ts +0 -0
  127. /package/dist/extensions/athenahealth/actions/{addProblemToPatientChart → createPatient}/config/index.js +0 -0
  128. /package/dist/extensions/athenahealth/actions/{addProblemToPatientChart/addProblemToPatientChart.test.d.ts → createPatient/createPatient.test.d.ts} +0 -0
  129. /package/dist/extensions/athenahealth/{actions/cancelAppointment/cancelAppointment.test.d.ts → api/schema/schema.test.d.ts} +0 -0
@@ -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":";;;AAAA,mEAMsC;AAGtC,iDAA6C;AAI7C,MAAa,iBAAkB,SAAQ,6BAAW;IACzC,KAAK,CAAC,aAAa,CAAC,EACzB,UAAU,EACV,IAAI,GAIL;QACC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAA8B;YAC7D,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,OAAO,UAAU,WAAW;YACjC,OAAO,EAAE,EAAE,cAAc,EAAE,mCAAmC,EAAE;YAChE,IAAI;SACL,CAAC,CAAA;QAEF,OAAO,MAAM,CAAC,CAAC,CAAC,CAAA;IAClB,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,EACtB,UAAU,EACV,SAAS,GAIV;QACC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAsB;YACrD,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,OAAO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E,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAC3D,CAAA;IACH,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,EACtB,UAAU,EACV,SAAS,GAIV;QACC,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;IAEM,KAAK,CAAC,cAAc,CAAC,EAC1B,UAAU,EACV,aAAa,GAId;QACC,OAAO,MAAM,IAAI,CAAC,SAAS,CACzB,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CACrE,CAAA;IACH,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAAC,EACjC,UAAU,EACV,aAAa,EACb,IAAI,GAKL;QACC,OAAO,MAAM,IAAI,CAAC,SAAS,CACzB,KAAK,EAAE,EAAE,EAAE,EAAE,CACX,MAAM,EAAE,CAAC,qBAAqB,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CACtE,CAAA;IACH,CAAC;CACF;AAvED,0CAuEC"}
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/api/schema/index.ts"],"names":[],"mappings":";;;AAAA,6CAA6E;AAAxC,gHAAA,iBAAiB,OAAA;AACtD,+BAA2E;AAAlE,oHAAA,4BAA4B,OAAA;AAAE,4GAAA,oBAAoB,OAAA;AAC3D,qCAAiE;AAAhC,wGAAA,aAAa,OAAA"}
@@ -0,0 +1,42 @@
1
+ import z from 'zod';
2
+ export interface CreatePatientResponseType {
3
+ patientid: string;
4
+ }
5
+ export declare const PatientSchema: z.ZodObject<{
6
+ firstname: z.ZodString;
7
+ lastname: z.ZodString;
8
+ dob: z.ZodEffects<z.ZodString, string, string>;
9
+ email: z.ZodString;
10
+ departmentid: z.ZodString;
11
+ primarydepartmentid: z.ZodString;
12
+ patientid: z.ZodString;
13
+ registrationdate: z.ZodEffects<z.ZodString, string, string>;
14
+ lastupdated: z.ZodEffects<z.ZodString, string, string>;
15
+ driverslicense: z.ZodBoolean;
16
+ status: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ status: string;
19
+ email: string;
20
+ dob: string;
21
+ departmentid: string;
22
+ firstname: string;
23
+ lastname: string;
24
+ patientid: string;
25
+ primarydepartmentid: string;
26
+ registrationdate: string;
27
+ lastupdated: string;
28
+ driverslicense: boolean;
29
+ }, {
30
+ status: string;
31
+ email: string;
32
+ dob: string;
33
+ departmentid: string;
34
+ firstname: string;
35
+ lastname: string;
36
+ patientid: string;
37
+ primarydepartmentid: string;
38
+ registrationdate: string;
39
+ lastupdated: string;
40
+ driverslicense: boolean;
41
+ }>;
42
+ export type PatientSchemaType = z.infer<typeof PatientSchema>;
@@ -0,0 +1,22 @@
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.PatientSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const date_1 = require("./date");
9
+ exports.PatientSchema = zod_1.default.object({
10
+ firstname: zod_1.default.string(),
11
+ lastname: zod_1.default.string(),
12
+ dob: date_1.AthenaDateOnlySchema,
13
+ email: zod_1.default.string(),
14
+ departmentid: zod_1.default.string(),
15
+ primarydepartmentid: zod_1.default.string(),
16
+ patientid: zod_1.default.string(),
17
+ registrationdate: date_1.AthenaDateOnlySchema,
18
+ lastupdated: date_1.AthenaDateOnlySchema,
19
+ driverslicense: zod_1.default.boolean(),
20
+ status: zod_1.default.string(),
21
+ });
22
+ //# sourceMappingURL=patient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patient.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/api/schema/patient.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAmB;AACnB,iCAA6C;AAMhC,QAAA,aAAa,GAAG,aAAC,CAAC,MAAM,CAAC;IACpC,SAAS,EAAE,aAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE;IACpB,GAAG,EAAE,2BAAoB;IACzB,KAAK,EAAE,aAAC,CAAC,MAAM,EAAE;IACjB,YAAY,EAAE,aAAC,CAAC,MAAM,EAAE;IACxB,mBAAmB,EAAE,aAAC,CAAC,MAAM,EAAE;IAC/B,SAAS,EAAE,aAAC,CAAC,MAAM,EAAE;IACrB,gBAAgB,EAAE,2BAAoB;IACtC,WAAW,EAAE,2BAAoB;IACjC,cAAc,EAAE,aAAC,CAAC,OAAO,EAAE;IAC3B,MAAM,EAAE,aAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAA"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const zod_1 = require("zod");
4
+ const date_1 = require("./date");
5
+ describe('athenahealth schema tests', () => {
6
+ describe('From athenahealth date to ISO date', () => {
7
+ test('01/02/2024 (January 2, 2024) should be parsed to the correct ISO format', () => {
8
+ const date = date_1.AthenaDateOnlySchema.parse('01/02/2024');
9
+ expect(date).toBe('2024-01-02');
10
+ });
11
+ test('11/30/1993 (November 30, 1993) should be parsed to the correct ISO format', () => {
12
+ const date = date_1.AthenaDateOnlySchema.parse('11/30/1993');
13
+ expect(date).toBe('1993-11-30');
14
+ });
15
+ test('invalid date should throw an error', async () => {
16
+ expect(() => {
17
+ date_1.AthenaDateOnlySchema.parse('11/33/1993');
18
+ }).toThrow(zod_1.ZodError);
19
+ });
20
+ });
21
+ });
22
+ //# sourceMappingURL=schema.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.test.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/api/schema/schema.test.ts"],"names":[],"mappings":";;AAAA,6BAA8B;AAC9B,iCAA6C;AAE7C,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAClD,IAAI,CAAC,yEAAyE,EAAE,GAAG,EAAE;YACnF,MAAM,IAAI,GAAG,2BAAoB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YACrD,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,2EAA2E,EAAE,GAAG,EAAE;YACrF,MAAM,IAAI,GAAG,2BAAoB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YACrD,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;YACpD,MAAM,CAAC,GAAG,EAAE;gBACV,2BAAoB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAC1C,CAAC,CAAC,CAAC,OAAO,CAAC,cAAQ,CAAC,CAAA;QACtB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,11 +1,13 @@
1
1
  import z from 'zod';
2
2
  import { AthenaAPIClient } from './api/client';
3
+ import { SettingsValidationSchema } from './settings';
3
4
  type ValidateAndCreateClient = <T extends z.ZodTypeAny>(args: {
4
5
  fieldsSchema: T;
5
6
  payload: unknown;
6
7
  }) => Promise<{
7
8
  client: AthenaAPIClient;
8
9
  fields: z.infer<(typeof args)['fieldsSchema']>;
10
+ settings: z.infer<typeof SettingsValidationSchema>;
9
11
  }>;
10
12
  export declare const validatePayloadAndCreateClient: ValidateAndCreateClient;
11
13
  export {};
@@ -9,7 +9,7 @@ const zod_1 = __importDefault(require("zod"));
9
9
  const client_1 = require("./api/client");
10
10
  const settings_1 = require("./settings");
11
11
  const validatePayloadAndCreateClient = async ({ fieldsSchema, payload, }) => {
12
- const { settings: { client_id, client_secret, auth_url, api_url, scope }, fields, } = (0, extensions_core_1.validate)({
12
+ const { settings: { client_id, client_secret, auth_url, api_url, scope }, fields, settings, } = (0, extensions_core_1.validate)({
13
13
  schema: zod_1.default.object({
14
14
  fields: fieldsSchema,
15
15
  settings: settings_1.SettingsValidationSchema,
@@ -25,7 +25,7 @@ const validatePayloadAndCreateClient = async ({ fieldsSchema, payload, }) => {
25
25
  },
26
26
  baseUrl: api_url,
27
27
  });
28
- return { client, fields };
28
+ return { client, fields, settings };
29
29
  };
30
30
  exports.validatePayloadAndCreateClient = validatePayloadAndCreateClient;
31
31
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../extensions/athenahealth/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAwD;AACxD,8CAAmB;AACnB,yCAA8C;AAC9C,yCAAqD;AAU9C,MAAM,8BAA8B,GAA4B,KAAK,EAAE,EAC5E,YAAY,EACZ,OAAO,GACR,EAAE,EAAE;IACH,MAAM,EACJ,QAAQ,EAAE,EA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AE,CAAA;AACrC,CAAC,CAAA;AA3BY,QAAA,8BAA8B,kCA2B1C"}
@@ -35,6 +35,13 @@ export declare const settings: {
35
35
  required: true;
36
36
  description: string;
37
37
  };
38
+ practiceId: {
39
+ key: string;
40
+ label: string;
41
+ obfuscated: false;
42
+ required: true;
43
+ description: string;
44
+ };
38
45
  };
39
46
  export declare const SettingsValidationSchema: z.ZodObject<{
40
47
  client_id: z.ZodString;
@@ -42,16 +49,19 @@ export declare const SettingsValidationSchema: z.ZodObject<{
42
49
  auth_url: z.ZodString;
43
50
  api_url: z.ZodString;
44
51
  scope: z.ZodString;
52
+ practiceId: z.ZodString;
45
53
  }, "strip", z.ZodTypeAny, {
46
54
  auth_url: string;
47
55
  client_id: string;
48
56
  client_secret: string;
49
57
  scope: string;
58
+ practiceId: string;
50
59
  api_url: string;
51
60
  }, {
52
61
  auth_url: string;
53
62
  client_id: string;
54
63
  client_secret: string;
55
64
  scope: string;
65
+ practiceId: string;
56
66
  api_url: string;
57
67
  }>;
@@ -38,12 +38,20 @@ exports.settings = {
38
38
  required: true,
39
39
  description: 'The value is a space-delimited, case-sensitive string of requested scopes.',
40
40
  },
41
+ practiceId: {
42
+ key: 'practiceId',
43
+ label: 'Practice ID',
44
+ obfuscated: false,
45
+ required: true,
46
+ description: 'The ID of your practice within athenahealth',
47
+ },
41
48
  };
42
49
  exports.SettingsValidationSchema = zod_1.z.object({
43
- client_id: zod_1.z.string(),
44
- client_secret: zod_1.z.string(),
50
+ client_id: zod_1.z.string().min(1),
51
+ client_secret: zod_1.z.string().min(1),
45
52
  auth_url: zod_1.z.string().url(),
46
53
  api_url: zod_1.z.string().url(),
47
- scope: zod_1.z.string(),
54
+ scope: zod_1.z.string().min(1),
55
+ practiceId: zod_1.z.string().min(1),
48
56
  });
49
57
  //# sourceMappingURL=settings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../extensions/athenahealth/settings.ts"],"names":[],"mappings":";;;AACA,6BAAwC;AAE3B,QAAA,QAAQ,GAAG;IACtB,QAAQ,EAAE;QACR,GAAG,EAAE,UAAU;QACf,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,uEAAuE;KAC1E;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,KAAK,EAAE,WAAW;QAClB,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,uEAAuE;KAC1E;IACD,aAAa,EAAE;QACb,GAAG,EAAE,eAAe;QACpB,KAAK,EAAE,eAAe;QACtB,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,uEAAuE;KAC1E;IACD,OAAO,EAAE;QACP,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,yCAAyC;KACvD;IACD,KAAK,EAAE;QACL,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,4EAA4E;KAC/E;CACgC,CAAA;AAEtB,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC1B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACzB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;CACkC,CAAC,CAAA"}
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../extensions/athenahealth/settings.ts"],"names":[],"mappings":";;;AACA,6BAAwC;AAE3B,QAAA,QAAQ,GAAG;IACtB,QAAQ,EAAE;QACR,G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AAC,CAAC,CAAC;IACxB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACsB,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Athena expects dates MM/dd/yyyy
4
+ */
5
+ export declare const AwellToAthenaDateOnlySchema: z.ZodEffects<z.ZodString, string, string>;
6
+ export declare const AwellToAthenaDateOnlyOptionalSchema: z.ZodUnion<[z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AwellToAthenaDateOnlyOptionalSchema = exports.AwellToAthenaDateOnlySchema = 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 expects dates MM/dd/yyyy
9
+ */
10
+ exports.AwellToAthenaDateOnlySchema = zod_1.z.string().transform((arg, ctx) => {
11
+ const date = new Date(arg);
12
+ if (!(0, date_fns_1.isValid)(date)) {
13
+ ctx.addIssue({
14
+ code: zod_1.z.ZodIssueCode.invalid_date,
15
+ message: 'No valid date',
16
+ });
17
+ return zod_1.z.NEVER;
18
+ }
19
+ return (0, date_fns_1.format)(date, 'MM/dd/yyyy');
20
+ });
21
+ exports.AwellToAthenaDateOnlyOptionalSchema = (0, extensions_core_1.makeStringOptional)(exports.AwellToAthenaDateOnlySchema);
22
+ //# sourceMappingURL=date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.js","sourceRoot":"","sources":["../../../../extensions/athenahealth/validation/date.ts"],"names":[],"mappings":";;;AAAA,mEAAkE;AAClE,uCAA0C;AAC1C,6BAAuB;AAEvB;;GAEG;AACU,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAC3E,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,eAAe;SACzB,CAAC,CAAA;QACF,OAAO,OAAC,CAAC,KAAK,CAAA;KACf;IAED,OAAO,IAAA,iBAAM,EAAC,IAAI,EAAE,YAAY,CAAC,CAAA;AACnC,CAAC,CAAC,CAAA;AAEW,QAAA,mCAAmC,GAAG,IAAA,oCAAkB,EACnE,mCAA2B,CAC5B,CAAA"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const date_1 = require("./date");
4
+ describe('athenahealth action field validation', () => {
5
+ describe('From ISO8601 date to athenahealth date', () => {
6
+ test('1993-11-30 should be parsed to DD/mm/yyyy', () => {
7
+ const date = date_1.AwellToAthenaDateOnlySchema.parse('1993-11-30');
8
+ expect(date).toBe('11/30/1993');
9
+ });
10
+ });
11
+ });
12
+ //# sourceMappingURL=validation.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.test.js","sourceRoot":"","sources":["../../../../extensions/athenahealth/validation/validation.test.ts"],"names":[],"mappings":";;AAAA,iCAAoD;AAEpD,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;IACpD,QAAQ,CAAC,wCAAwC,EAAE,GAAG,EAAE;QACtD,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACrD,MAAM,IAAI,GAAG,kCAA2B,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAC5D,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "athenahealth": {
3
- "readme": "---\ntitle: Athena\ndescription: Athena offers medical groups, hospitals, and health systems cloud-based EHR, practice management, and patient engagement services that seamlessly connect care and drive results for every client. \n---\n\nMore information coming soon.",
3
+ "readme": "---\ntitle: Athena\ndescription: Athena offers medical groups, hospitals, and health systems cloud-based EHR, practice management, and patient engagement services that seamlessly connect care and drive results for every client. \n---\n\n## Actions\n\n### Create patient\n\nCreates a patient in athenahealth. First name, last name, date of birth, email, and department ID are required. If a patient with the same name, date of birth, and email already exists, a new patient record will not be created. Instead, the existing patient's ID will be returned.\n\n### Get patient\n\nRetrieve the details of a given patient within a given practice.\n\n### Get appointment\n\nRetrieve the details of an appointment.",
4
4
  "changelog": "# Athena changelog"
5
5
  },
6
6
  "avaAi": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "1.0.214",
3
+ "version": "1.0.216",
4
4
  "packageManager": "yarn@3.4.1",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {
@@ -1,4 +0,0 @@
1
- import { type Action } from '@awell-health/extensions-core';
2
- import { type settings } from '../../settings';
3
- import { fields, dataPoints } from './config';
4
- export declare const addDocumentToPatientChart: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addDocumentToPatientChart = void 0;
4
- const extensions_core_1 = require("@awell-health/extensions-core");
5
- const config_1 = require("./config");
6
- const helpers_1 = require("../../helpers");
7
- exports.addDocumentToPatientChart = {
8
- key: 'addDocumentToPatientChart',
9
- category: extensions_core_1.Category.EHR_INTEGRATIONS,
10
- title: 'Add document to patient chart',
11
- description: "Adds a document to the patient's chart",
12
- fields: config_1.fields,
13
- previewable: false,
14
- dataPoints: config_1.dataPoints,
15
- onActivityCreated: async (payload, onComplete, onError) => {
16
- const { fields: input, client } = await (0, helpers_1.validatePayloadAndCreateClient)({
17
- fieldsSchema: config_1.FieldsValidationSchema,
18
- payload,
19
- });
20
- console.log(input, client);
21
- await onComplete();
22
- },
23
- };
24
- //# sourceMappingURL=addDocumentToPatientChart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addDocumentToPatientChart.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/actions/addDocumentToPatientChart/addDocumentToPatientChart.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,2CAA8D;AAEjD,QAAA,yBAAyB,GAIlC;IACF,GAAG,EAAE,2BAA2B;IAChC,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,+BAA+B;IACtC,WAAW,EAAE,wCAAwC;IACrD,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,MAAM,UAAU,EAAE,CAAA;IACpB,CAAC;CACF,CAAA"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _1 = require(".");
4
- const tests_1 = require("../../../../src/tests");
5
- describe('Athena - Cancel 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
- };
13
- const onComplete = jest.fn();
14
- const onError = jest.fn();
15
- test('Should return an appointment', async () => {
16
- const mockOnActivityCreateParams = (0, tests_1.generateTestPayload)({
17
- fields: {
18
- patientId: '1',
19
- practiceId: '1',
20
- departmentId: '1',
21
- actionNote: 'Some note',
22
- documentContent: 'Some content',
23
- autoClose: false,
24
- },
25
- settings,
26
- });
27
- await _1.addDocumentToPatientChart.onActivityCreated(mockOnActivityCreateParams, onComplete, onError);
28
- expect(onComplete).toHaveBeenCalled();
29
- });
30
- });
31
- //# sourceMappingURL=addDocumentToPatientChart.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addDocumentToPatientChart.test.js","sourceRoot":"","sources":["../../../../../extensions/athenahealth/actions/addDocumentToPatientChart/addDocumentToPatientChart.test.ts"],"names":[],"mappings":";;AAAA,wBAA6C;AAC7C,iDAA2D;AAE3D,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,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,SAAS,EAAE,GAAG;gBACd,UAAU,EAAE,GAAG;gBACf,YAAY,EAAE,GAAG;gBACjB,UAAU,EAAE,WAAW;gBACvB,eAAe,EAAE,cAAc;gBAC/B,SAAS,EAAE,KAAK;aACjB;YACD,QAAQ;SACT,CAAC,CAAA;QAEF,MAAM,4BAAyB,CAAC,iBAAiB,CAC/C,0BAA0B,EAC1B,UAAU,EACV,OAAO,CACR,CAAA;QAED,MAAM,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE,CAAA;IACvC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"datapoints.js","sourceRoot":"","sources":["../../../../../../extensions/athenahealth/actions/addDocumentToPatientChart/config/datapoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,EAAgD,CAAA"}
@@ -1,61 +0,0 @@
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.FieldsValidationSchema = exports.fields = void 0;
7
- const extensions_core_1 = require("@awell-health/extensions-core");
8
- const zod_1 = __importDefault(require("zod"));
9
- exports.fields = {
10
- patientId: {
11
- id: 'patientId',
12
- label: 'Patient ID',
13
- description: '',
14
- type: extensions_core_1.FieldType.STRING,
15
- required: true,
16
- },
17
- practiceId: {
18
- id: 'practiceId',
19
- label: 'Practice ID',
20
- description: '',
21
- type: extensions_core_1.FieldType.STRING,
22
- required: true,
23
- },
24
- departmentId: {
25
- id: 'departmentId',
26
- label: 'Department ID',
27
- description: 'The department ID associated with the uploaded document.',
28
- type: extensions_core_1.FieldType.STRING,
29
- required: true,
30
- },
31
- actionNote: {
32
- id: 'actionNote',
33
- label: 'Any note to accompany the creation of this document',
34
- description: '',
35
- type: extensions_core_1.FieldType.STRING,
36
- required: false,
37
- },
38
- documentContent: {
39
- id: 'documentContent',
40
- label: 'Content of the document',
41
- description: '',
42
- type: extensions_core_1.FieldType.HTML,
43
- required: true,
44
- },
45
- autoClose: {
46
- id: 'autoClose',
47
- label: 'Auto close?',
48
- description: 'Documents will, normally, automatically appear in the clinical inbox for providers to review. In some cases, you might want to force the document to skip the clinical inbox, and go directly to the patient chart with a "closed" status.',
49
- type: extensions_core_1.FieldType.BOOLEAN,
50
- required: true,
51
- },
52
- };
53
- exports.FieldsValidationSchema = zod_1.default.object({
54
- patientId: zod_1.default.string(),
55
- practiceId: zod_1.default.string(),
56
- departmentId: zod_1.default.string(),
57
- actionNote: zod_1.default.string(),
58
- documentContent: zod_1.default.string(),
59
- autoClose: zod_1.default.boolean(),
60
- });
61
- //# sourceMappingURL=fields.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/athenahealth/actions/addDocumentToPatientChart/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,8CAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,0DAA0D;QACvE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,qDAAqD;QAC5D,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,eAAe,EAAE;QACf,EAAE,EAAE,iBAAiB;QACrB,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,4OAA4O;QAC9O,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,aAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,aAAC,CAAC,MAAM,EAAE;IACtB,YAAY,EAAE,aAAC,CAAC,MAAM,EAAE;IACxB,UAAU,EAAE,aAAC,CAAC,MAAM,EAAE;IACtB,eAAe,EAAE,aAAC,CAAC,MAAM,EAAE;IAC3B,SAAS,EAAE,aAAC,CAAC,OAAO,EAAE;CAC2B,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/athenahealth/actions/addDocumentToPatientChart/config/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AACvC,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}