@awell-health/awell-extensions 1.1.43-beta42 → 1.1.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. package/dist/extensions/awell/v1/webhooks/index.d.ts +1 -1
  2. package/dist/extensions/awell/v1/webhooks/pathwayStart.d.ts +1 -3
  3. package/dist/extensions/awell/v1/webhooks/pathwayStart.js +3 -13
  4. package/dist/extensions/awell/v1/webhooks/pathwayStart.js.map +1 -1
  5. package/dist/extensions/calDotCom/webhooks/index.d.ts +1 -1
  6. package/dist/extensions/calendly/webhooks/index.d.ts +1 -1
  7. package/dist/extensions/elation/webhooks/index.d.ts +1 -1
  8. package/dist/extensions/healthie/lib/sdk/errors.d.ts +0 -1
  9. package/dist/extensions/healthie/lib/sdk/errors.js +1 -42
  10. package/dist/extensions/healthie/lib/sdk/errors.js.map +1 -1
  11. package/dist/extensions/healthie/lib/sdk/generated/sdk.d.ts +9 -373
  12. package/dist/extensions/healthie/lib/sdk/generated/sdk.js +3 -110
  13. package/dist/extensions/healthie/lib/sdk/generated/sdk.js.map +1 -1
  14. package/dist/extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.d.ts +1 -11
  15. package/dist/extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.js +1 -15
  16. package/dist/extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.js.map +1 -1
  17. package/dist/extensions/healthie/lib/types.d.ts +0 -1
  18. package/dist/extensions/healthie/lib/types.js +0 -2
  19. package/dist/extensions/healthie/lib/types.js.map +1 -1
  20. package/dist/extensions/healthie/webhooks/appliedTagCreated.d.ts +1 -2
  21. package/dist/extensions/healthie/webhooks/appliedTagCreated.js +7 -19
  22. package/dist/extensions/healthie/webhooks/appliedTagCreated.js.map +1 -1
  23. package/dist/extensions/healthie/webhooks/appliedTagDeleted.d.ts +1 -2
  24. package/dist/extensions/healthie/webhooks/appliedTagDeleted.js +7 -19
  25. package/dist/extensions/healthie/webhooks/appliedTagDeleted.js.map +1 -1
  26. package/dist/extensions/healthie/webhooks/appointmentCreated.d.ts +1 -6
  27. package/dist/extensions/healthie/webhooks/appointmentCreated.js +6 -25
  28. package/dist/extensions/healthie/webhooks/appointmentCreated.js.map +1 -1
  29. package/dist/extensions/healthie/webhooks/appointmentDeleted.d.ts +1 -2
  30. package/dist/extensions/healthie/webhooks/appointmentDeleted.js +6 -21
  31. package/dist/extensions/healthie/webhooks/appointmentDeleted.js.map +1 -1
  32. package/dist/extensions/healthie/webhooks/appointmentUpdated.d.ts +1 -6
  33. package/dist/extensions/healthie/webhooks/appointmentUpdated.js +6 -25
  34. package/dist/extensions/healthie/webhooks/appointmentUpdated.js.map +1 -1
  35. package/dist/extensions/healthie/webhooks/formAnswerGroupCreated.d.ts +1 -6
  36. package/dist/extensions/healthie/webhooks/formAnswerGroupCreated.js +7 -26
  37. package/dist/extensions/healthie/webhooks/formAnswerGroupCreated.js.map +1 -1
  38. package/dist/extensions/healthie/webhooks/formAnswerGroupDeleted.d.ts +1 -2
  39. package/dist/extensions/healthie/webhooks/formAnswerGroupDeleted.js +6 -20
  40. package/dist/extensions/healthie/webhooks/formAnswerGroupDeleted.js.map +1 -1
  41. package/dist/extensions/healthie/webhooks/formAnswerGroupLocked.d.ts +1 -6
  42. package/dist/extensions/healthie/webhooks/formAnswerGroupLocked.js +6 -25
  43. package/dist/extensions/healthie/webhooks/formAnswerGroupLocked.js.map +1 -1
  44. package/dist/extensions/healthie/webhooks/formAnswerGroupSigned.d.ts +1 -6
  45. package/dist/extensions/healthie/webhooks/formAnswerGroupSigned.js +6 -25
  46. package/dist/extensions/healthie/webhooks/formAnswerGroupSigned.js.map +1 -1
  47. package/dist/extensions/healthie/webhooks/goalCreated.d.ts +2 -3
  48. package/dist/extensions/healthie/webhooks/goalCreated.js +9 -21
  49. package/dist/extensions/healthie/webhooks/goalCreated.js.map +1 -1
  50. package/dist/extensions/healthie/webhooks/goalDeleted.d.ts +11 -0
  51. package/dist/extensions/healthie/webhooks/goalDeleted.js +30 -0
  52. package/dist/extensions/healthie/webhooks/goalDeleted.js.map +1 -0
  53. package/dist/extensions/healthie/webhooks/goalUpdated.d.ts +1 -2
  54. package/dist/extensions/healthie/webhooks/goalUpdated.js +8 -20
  55. package/dist/extensions/healthie/webhooks/goalUpdated.js.map +1 -1
  56. package/dist/extensions/healthie/webhooks/index.d.ts +5 -316
  57. package/dist/extensions/healthie/webhooks/index.js +8 -0
  58. package/dist/extensions/healthie/webhooks/index.js.map +1 -1
  59. package/dist/extensions/healthie/webhooks/labOrderCreated.d.ts +1 -2
  60. package/dist/extensions/healthie/webhooks/labOrderCreated.js +7 -19
  61. package/dist/extensions/healthie/webhooks/labOrderCreated.js.map +1 -1
  62. package/dist/extensions/healthie/webhooks/labOrderUpdated.d.ts +1 -2
  63. package/dist/extensions/healthie/webhooks/labOrderUpdated.js +7 -19
  64. package/dist/extensions/healthie/webhooks/labOrderUpdated.js.map +1 -1
  65. package/dist/extensions/healthie/webhooks/messageCreated.d.ts +1 -2
  66. package/dist/extensions/healthie/webhooks/messageCreated.js +7 -20
  67. package/dist/extensions/healthie/webhooks/messageCreated.js.map +1 -1
  68. package/dist/extensions/healthie/webhooks/messageDeleted.d.ts +1 -2
  69. package/dist/extensions/healthie/webhooks/messageDeleted.js +7 -20
  70. package/dist/extensions/healthie/webhooks/messageDeleted.js.map +1 -1
  71. package/dist/extensions/healthie/webhooks/metricEntryCreated.d.ts +1 -2
  72. package/dist/extensions/healthie/webhooks/metricEntryCreated.js +7 -19
  73. package/dist/extensions/healthie/webhooks/metricEntryCreated.js.map +1 -1
  74. package/dist/extensions/healthie/webhooks/metricEntryDeleted.d.ts +11 -0
  75. package/dist/extensions/healthie/webhooks/metricEntryDeleted.js +30 -0
  76. package/dist/extensions/healthie/webhooks/metricEntryDeleted.js.map +1 -0
  77. package/dist/extensions/healthie/webhooks/metricEntryUpdated.d.ts +1 -2
  78. package/dist/extensions/healthie/webhooks/metricEntryUpdated.js +7 -19
  79. package/dist/extensions/healthie/webhooks/metricEntryUpdated.js.map +1 -1
  80. package/dist/extensions/healthie/webhooks/patientCreated.js +0 -5
  81. package/dist/extensions/healthie/webhooks/patientCreated.js.map +1 -1
  82. package/dist/extensions/healthie/webhooks/patientUpdated.js +0 -5
  83. package/dist/extensions/healthie/webhooks/patientUpdated.js.map +1 -1
  84. package/dist/extensions/healthie/webhooks/requestedFormCompletionCreated.d.ts +1 -2
  85. package/dist/extensions/healthie/webhooks/requestedFormCompletionCreated.js +7 -19
  86. package/dist/extensions/healthie/webhooks/requestedFormCompletionCreated.js.map +1 -1
  87. package/dist/extensions/healthie/webhooks/requestedFormCompletionDeleted.d.ts +11 -0
  88. package/dist/extensions/healthie/webhooks/requestedFormCompletionDeleted.js +30 -0
  89. package/dist/extensions/healthie/webhooks/requestedFormCompletionDeleted.js.map +1 -0
  90. package/dist/extensions/healthie/webhooks/requestedFormCompletionUpdated.d.ts +1 -2
  91. package/dist/extensions/healthie/webhooks/requestedFormCompletionUpdated.js +7 -19
  92. package/dist/extensions/healthie/webhooks/requestedFormCompletionUpdated.js.map +1 -1
  93. package/dist/extensions/healthie/webhooks/taskCreated.d.ts +1 -2
  94. package/dist/extensions/healthie/webhooks/taskCreated.js +7 -19
  95. package/dist/extensions/healthie/webhooks/taskCreated.js.map +1 -1
  96. package/dist/extensions/healthie/webhooks/taskDeleted.d.ts +11 -0
  97. package/dist/extensions/healthie/webhooks/taskDeleted.js +30 -0
  98. package/dist/extensions/healthie/webhooks/taskDeleted.js.map +1 -0
  99. package/dist/extensions/healthie/webhooks/taskUpdated.d.ts +1 -2
  100. package/dist/extensions/healthie/webhooks/taskUpdated.js +8 -20
  101. package/dist/extensions/healthie/webhooks/taskUpdated.js.map +1 -1
  102. package/dist/extensions/hello-world/webhooks/index.d.ts +1 -1
  103. package/dist/extensions/zusHealth/webhooks/index.d.ts +1 -37
  104. package/dist/extensions/zusHealth/webhooks/patientAdmitted.d.ts +1 -2
  105. package/dist/extensions/zusHealth/webhooks/patientAdmitted.js.map +1 -1
  106. package/dist/extensions/zusHealth/webhooks/patientDischarged.d.ts +1 -2
  107. package/dist/extensions/zusHealth/webhooks/patientDischarged.js.map +1 -1
  108. package/dist/src/test-server.js +0 -4
  109. package/dist/src/test-server.js.map +1 -1
  110. package/package.json +4 -5
  111. package/dist/extensions/healthie/lib/sdk/createSdk.d.ts +0 -10
  112. package/dist/extensions/healthie/lib/sdk/createSdk.js +0 -17
  113. package/dist/extensions/healthie/lib/sdk/createSdk.js.map +0 -1
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.goalUpdated = void 0;
4
4
  const lodash_1 = require("lodash");
5
- const types_1 = require("../lib/types");
6
- const createSdk_1 = require("../lib/sdk/createSdk");
7
- const errors_1 = require("../lib/sdk/errors");
8
5
  const dataPoints = {
9
6
  updatedGoalId: {
10
7
  key: 'updatedGoalId',
@@ -15,28 +12,19 @@ exports.goalUpdated = {
15
12
  key: 'goalUpdated',
16
13
  dataPoints,
17
14
  onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
18
- var _a, _b;
19
- try {
20
- const { sdk } = await (0, createSdk_1.createSdk)({ settings });
21
- const updatedGoalId = payload.resource_id.toString();
22
- const response = await sdk.getGoal({ id: updatedGoalId });
23
- const healthiePatientId = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.goal) === null || _b === void 0 ? void 0 : _b.user_id;
15
+ const { resource_id: updatedGoalId } = payload;
16
+ if ((0, lodash_1.isNil)(updatedGoalId)) {
17
+ await onError({
18
+ // We should automatically send a 400 here, so no need to provide info
19
+ });
20
+ }
21
+ else {
24
22
  await onSuccess({
25
23
  data_points: {
26
24
  updatedGoalId,
27
25
  },
28
- ...(!(0, lodash_1.isNil)(healthiePatientId) && {
29
- patient_identifier: {
30
- system: types_1.HEALTHIE_IDENTIFIER,
31
- value: healthiePatientId,
32
- },
33
- }),
34
26
  });
35
27
  }
36
- catch (error) {
37
- const formattedError = (0, errors_1.formatErrors)(error);
38
- await onError(formattedError);
39
- }
40
- }
28
+ },
41
29
  };
42
30
  //# sourceMappingURL=goalUpdated.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"goalUpdated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/goalUpdated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAK9B,wCAA+E;AAE/E,oDAAgD;AAChD,8CAAgD;AAEhD,MAAM,UAAU,GAAG;IACjB,aAAa,EAAE;QACb,GAAG,EAAE,eAAe;QACpB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,WAAW,GAIpB;IACF,GAAG,EAAE,aAAa;IAClB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;;QACrE,IAAI;YACF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAA,qBAAS,EAAC,EAAC,QAAQ,EAAC,CAAC,CAAA;YAC3C,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;YAErD,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,CAAA;YACzD,MAAM,iBAAiB,GAAG,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,IAAI,0CAAE,OAAO,CAAA;YACvD,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACX,aAAa;iBACd;gBACD,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,iBAAiB,CAAC,IAAI;oBAC/B,kBAAkB,EAAE;wBAClB,MAAM,EAAE,2BAAmB;wBAC3B,KAAK,EAAE,iBAAiB;qBACzB;iBACF,CAAC;aACH,CAAC,CAAA;SACH;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,cAAc,GAAG,IAAA,qBAAY,EAAC,KAAK,CAAC,CAAA;YAC1C,MAAM,OAAO,CAAC,cAAc,CAAC,CAAA;SAC9B;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"goalUpdated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/goalUpdated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAO9B,MAAM,UAAU,GAAG;IACjB,aAAa,EAAE;QACb,GAAG,EAAE,eAAe;QACpB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,WAAW,GAGpB;IACF,GAAG,EAAE,aAAa;IAClB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACrE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,CAAA;QAE9C,IAAI,IAAA,cAAK,EAAC,aAAa,CAAC,EAAE;YACxB,MAAM,OAAO,CAAC;YACZ,sEAAsE;aACvE,CAAC,CAAA;SACH;aAAM;YACL,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACX,aAAa;iBACd;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF,CAAA"}
@@ -13,327 +13,16 @@ export type { LabOrderUpdated } from './labOrderUpdated';
13
13
  export type { MessageCreated } from './messageCreated';
14
14
  export type { MessageDeleted } from './messageDeleted';
15
15
  export type { MetricEntryCreated } from './metricEntryCreated';
16
+ export type { MetricEntryDeleted } from './metricEntryDeleted';
16
17
  export type { MetricEntryUpdated } from './metricEntryUpdated';
17
18
  export type { PatientUpdated } from './patientUpdated';
18
19
  export type { RequestFormCompletionCreated } from './requestedFormCompletionCreated';
20
+ export type { RequestFormCompletionDeleted } from './requestedFormCompletionDeleted';
19
21
  export type { RequestFormCompletionUpdated } from './requestedFormCompletionUpdated';
20
22
  export type { TaskCreated } from './taskCreated';
23
+ export type { TaskDeleted } from './taskDeleted';
21
24
  export type { TaskUpdated } from './taskUpdated';
22
25
  export type { GoalCreated } from './goalCreated';
23
26
  export type { GoalUpdated } from './goalUpdated';
24
- export declare const webhooks: (import("@awell-health/extensions-core").Webhook<"appointmentId" | "appointment", import("../lib/types").HealthieWebhookPayload, {
25
- apiUrl: {
26
- key: string;
27
- label: string;
28
- obfuscated: false;
29
- required: true;
30
- description: string;
31
- };
32
- apiKey: {
33
- key: string;
34
- label: string;
35
- obfuscated: true;
36
- required: true;
37
- description: string;
38
- };
39
- }> | import("@awell-health/extensions-core").Webhook<"patientId", import("../lib/types").HealthieWebhookPayload, Record<string, import("@awell-health/extensions-core").Setting>> | import("@awell-health/extensions-core").Webhook<"createdAppliedTagId", import("../lib/types").HealthieWebhookPayload, {
40
- apiUrl: {
41
- key: string;
42
- label: string;
43
- obfuscated: false;
44
- required: true;
45
- description: string;
46
- };
47
- apiKey: {
48
- key: string;
49
- label: string;
50
- obfuscated: true;
51
- required: true;
52
- description: string;
53
- };
54
- }> | import("@awell-health/extensions-core").Webhook<"deletedAppliedTagId", import("../lib/types").HealthieWebhookPayload, {
55
- apiUrl: {
56
- key: string;
57
- label: string;
58
- obfuscated: false;
59
- required: true;
60
- description: string;
61
- };
62
- apiKey: {
63
- key: string;
64
- label: string;
65
- obfuscated: true;
66
- required: true;
67
- description: string;
68
- };
69
- }> | import("@awell-health/extensions-core").Webhook<"deletedAppointmentId", import("../lib/types").HealthieWebhookPayload, {
70
- apiUrl: {
71
- key: string;
72
- label: string;
73
- obfuscated: false;
74
- required: true;
75
- description: string;
76
- };
77
- apiKey: {
78
- key: string;
79
- label: string;
80
- obfuscated: true;
81
- required: true;
82
- description: string;
83
- };
84
- }> | import("@awell-health/extensions-core").Webhook<"appointment" | "updatedAppointmentId", import("../lib/types").HealthieWebhookPayload, {
85
- apiUrl: {
86
- key: string;
87
- label: string;
88
- obfuscated: false;
89
- required: true;
90
- description: string;
91
- };
92
- apiKey: {
93
- key: string;
94
- label: string;
95
- obfuscated: true;
96
- required: true;
97
- description: string;
98
- };
99
- }> | import("@awell-health/extensions-core").Webhook<"createdFormAnswerGroupId" | "createdFormAnswerGroup", import("../lib/types").HealthieWebhookPayload, {
100
- apiUrl: {
101
- key: string;
102
- label: string;
103
- obfuscated: false;
104
- required: true;
105
- description: string;
106
- };
107
- apiKey: {
108
- key: string;
109
- label: string;
110
- obfuscated: true;
111
- required: true;
112
- description: string;
113
- };
114
- }> | import("@awell-health/extensions-core").Webhook<"deletedFormAnswerGroupId", import("../lib/types").HealthieWebhookPayload, {
115
- apiUrl: {
116
- key: string;
117
- label: string;
118
- obfuscated: false;
119
- required: true;
120
- description: string;
121
- };
122
- apiKey: {
123
- key: string;
124
- label: string;
125
- obfuscated: true;
126
- required: true;
127
- description: string;
128
- };
129
- }> | import("@awell-health/extensions-core").Webhook<"lockedFormAnswerGroupId" | "lockedFormAnswerGroup", import("../lib/types").HealthieWebhookPayload, {
130
- apiUrl: {
131
- key: string;
132
- label: string;
133
- obfuscated: false;
134
- required: true;
135
- description: string;
136
- };
137
- apiKey: {
138
- key: string;
139
- label: string;
140
- obfuscated: true;
141
- required: true;
142
- description: string;
143
- };
144
- }> | import("@awell-health/extensions-core").Webhook<"signedFormAnswerGroupId" | "signedFormAnswerGroup", import("../lib/types").HealthieWebhookPayload, {
145
- apiUrl: {
146
- key: string;
147
- label: string;
148
- obfuscated: false;
149
- required: true;
150
- description: string;
151
- };
152
- apiKey: {
153
- key: string;
154
- label: string;
155
- obfuscated: true;
156
- required: true;
157
- description: string;
158
- };
159
- }> | import("@awell-health/extensions-core").Webhook<"createdLabOrderId", import("../lib/types").HealthieWebhookPayload, {
160
- apiUrl: {
161
- key: string;
162
- label: string;
163
- obfuscated: false;
164
- required: true;
165
- description: string;
166
- };
167
- apiKey: {
168
- key: string;
169
- label: string;
170
- obfuscated: true;
171
- required: true;
172
- description: string;
173
- };
174
- }> | import("@awell-health/extensions-core").Webhook<"updatedLabOrderId", import("../lib/types").HealthieWebhookPayload, {
175
- apiUrl: {
176
- key: string;
177
- label: string;
178
- obfuscated: false;
179
- required: true;
180
- description: string;
181
- };
182
- apiKey: {
183
- key: string;
184
- label: string;
185
- obfuscated: true;
186
- required: true;
187
- description: string;
188
- };
189
- }> | import("@awell-health/extensions-core").Webhook<"createdMessageId", import("../lib/types").HealthieWebhookPayload, {
190
- apiUrl: {
191
- key: string;
192
- label: string;
193
- obfuscated: false;
194
- required: true;
195
- description: string;
196
- };
197
- apiKey: {
198
- key: string;
199
- label: string;
200
- obfuscated: true;
201
- required: true;
202
- description: string;
203
- };
204
- }> | import("@awell-health/extensions-core").Webhook<"deletedMessageId", import("../lib/types").HealthieWebhookPayload, {
205
- apiUrl: {
206
- key: string;
207
- label: string;
208
- obfuscated: false;
209
- required: true;
210
- description: string;
211
- };
212
- apiKey: {
213
- key: string;
214
- label: string;
215
- obfuscated: true;
216
- required: true;
217
- description: string;
218
- };
219
- }> | import("@awell-health/extensions-core").Webhook<"createdMetricId", import("../lib/types").HealthieWebhookPayload, {
220
- apiUrl: {
221
- key: string;
222
- label: string;
223
- obfuscated: false;
224
- required: true;
225
- description: string;
226
- };
227
- apiKey: {
228
- key: string;
229
- label: string;
230
- obfuscated: true;
231
- required: true;
232
- description: string;
233
- };
234
- }> | import("@awell-health/extensions-core").Webhook<"updatedMetricId", import("../lib/types").HealthieWebhookPayload, {
235
- apiUrl: {
236
- key: string;
237
- label: string;
238
- obfuscated: false;
239
- required: true;
240
- description: string;
241
- };
242
- apiKey: {
243
- key: string;
244
- label: string;
245
- obfuscated: true;
246
- required: true;
247
- description: string;
248
- };
249
- }> | import("@awell-health/extensions-core").Webhook<"updatedPatientId", import("../lib/types").HealthieWebhookPayload, Record<string, import("@awell-health/extensions-core").Setting>> | import("@awell-health/extensions-core").Webhook<"createdFormCompletionId", import("../lib/types").HealthieWebhookPayload, {
250
- apiUrl: {
251
- key: string;
252
- label: string;
253
- obfuscated: false;
254
- required: true;
255
- description: string;
256
- };
257
- apiKey: {
258
- key: string;
259
- label: string;
260
- obfuscated: true;
261
- required: true;
262
- description: string;
263
- };
264
- }> | import("@awell-health/extensions-core").Webhook<"updatedFormCompletionId", import("../lib/types").HealthieWebhookPayload, {
265
- apiUrl: {
266
- key: string;
267
- label: string;
268
- obfuscated: false;
269
- required: true;
270
- description: string;
271
- };
272
- apiKey: {
273
- key: string;
274
- label: string;
275
- obfuscated: true;
276
- required: true;
277
- description: string;
278
- };
279
- }> | import("@awell-health/extensions-core").Webhook<"createdTaskId", import("../lib/types").HealthieWebhookPayload, {
280
- apiUrl: {
281
- key: string;
282
- label: string;
283
- obfuscated: false;
284
- required: true;
285
- description: string;
286
- };
287
- apiKey: {
288
- key: string;
289
- label: string;
290
- obfuscated: true;
291
- required: true;
292
- description: string;
293
- };
294
- }> | import("@awell-health/extensions-core").Webhook<"updatedTaskId", import("../lib/types").HealthieWebhookPayload, {
295
- apiUrl: {
296
- key: string;
297
- label: string;
298
- obfuscated: false;
299
- required: true;
300
- description: string;
301
- };
302
- apiKey: {
303
- key: string;
304
- label: string;
305
- obfuscated: true;
306
- required: true;
307
- description: string;
308
- };
309
- }> | import("@awell-health/extensions-core").Webhook<"createdGoalId", import("../lib/types").HealthieWebhookPayload, {
310
- apiUrl: {
311
- key: string;
312
- label: string;
313
- obfuscated: false;
314
- required: true;
315
- description: string;
316
- };
317
- apiKey: {
318
- key: string;
319
- label: string;
320
- obfuscated: true;
321
- required: true;
322
- description: string;
323
- };
324
- }> | import("@awell-health/extensions-core").Webhook<"updatedGoalId", import("../lib/types").HealthieWebhookPayload, {
325
- apiUrl: {
326
- key: string;
327
- label: string;
328
- obfuscated: false;
329
- required: true;
330
- description: string;
331
- };
332
- apiKey: {
333
- key: string;
334
- label: string;
335
- obfuscated: true;
336
- required: true;
337
- description: string;
338
- };
339
- }>)[];
27
+ export type { GoalDeleted } from './goalDeleted';
28
+ export declare const webhooks: (import("@awell-health/extensions-core").Webhook<"appointmentId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"patientId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"createdAppliedTagId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"deletedAppliedTagId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"deletedAppointmentId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"updatedAppointmentId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"createdFormAnswerGroupId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"deletedFormAnswerGroupId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"lockedFormAnswerGroupId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"signedFormAnswerGroupId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"createdLabOrderId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"updatedLabOrderId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"createdMessageId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"deletedMessageId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"createdMetricId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"deletedMetricId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"updatedMetricId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"updatedPatientId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"createdFormCompletionId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"deletedFormCompletionId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"updatedFormCompletionId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"createdTaskId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"deletedTaskId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"updatedTaskId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"createdGoalId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"updatedGoalId", import("../lib/types").HealthieWebhookPayload> | import("@awell-health/extensions-core").Webhook<"deletedGoalId", import("../lib/types").HealthieWebhookPayload>)[];
@@ -16,14 +16,18 @@ const labOrderUpdated_1 = require("./labOrderUpdated");
16
16
  const messageCreated_1 = require("./messageCreated");
17
17
  const messageDeleted_1 = require("./messageDeleted");
18
18
  const metricEntryCreated_1 = require("./metricEntryCreated");
19
+ const metricEntryDeleted_1 = require("./metricEntryDeleted");
19
20
  const metricEntryUpdated_1 = require("./metricEntryUpdated");
20
21
  const patientUpdated_1 = require("./patientUpdated");
21
22
  const requestedFormCompletionCreated_1 = require("./requestedFormCompletionCreated");
23
+ const requestedFormCompletionDeleted_1 = require("./requestedFormCompletionDeleted");
22
24
  const requestedFormCompletionUpdated_1 = require("./requestedFormCompletionUpdated");
23
25
  const taskCreated_1 = require("./taskCreated");
26
+ const taskDeleted_1 = require("./taskDeleted");
24
27
  const taskUpdated_1 = require("./taskUpdated");
25
28
  const goalCreated_1 = require("./goalCreated");
26
29
  const goalUpdated_1 = require("./goalUpdated");
30
+ const goalDeleted_1 = require("./goalDeleted");
27
31
  exports.webhooks = [
28
32
  appointmentCreated_1.appointmentCreated,
29
33
  patientCreated_1.patientCreated,
@@ -40,13 +44,17 @@ exports.webhooks = [
40
44
  messageCreated_1.messageCreated,
41
45
  messageDeleted_1.messageDeleted,
42
46
  metricEntryCreated_1.metricEntryCreated,
47
+ metricEntryDeleted_1.metricEntryDeleted,
43
48
  metricEntryUpdated_1.metricEntryUpdated,
44
49
  patientUpdated_1.patientUpdated,
45
50
  requestedFormCompletionCreated_1.requestFormCompletionCreated,
51
+ requestedFormCompletionDeleted_1.requestFormCompletionDeleted,
46
52
  requestedFormCompletionUpdated_1.requestFormCompletionUpdated,
47
53
  taskCreated_1.taskCreated,
54
+ taskDeleted_1.taskDeleted,
48
55
  taskUpdated_1.taskUpdated,
49
56
  goalCreated_1.goalCreated,
50
57
  goalUpdated_1.goalUpdated,
58
+ goalDeleted_1.goalDeleted,
51
59
  ];
52
60
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/index.ts"],"names":[],"mappings":";;;AAAA,6DAAyD;AACzD,qDAAiD;AACjD,2DAAuD;AACvD,2DAAuD;AACvD,6DAAyD;AACzD,6DAAyD;AACzD,qEAAiE;AACjE,qEAAiE;AACjE,mEAA+D;AAC/D,mEAA+D;AAC/D,uDAAmD;AACnD,uDAAmD;AACnD,qDAAiD;AACjD,qDAAiD;AACjD,6DAAyD;AACzD,6DAAyD;AACzD,qDAAiD;AACjD,qFAA+E;AAC/E,qFAA+E;AAC/E,+CAA2C;AAC3C,+CAA2C;AAC3C,+CAA2C;AAC3C,+CAA2C;AA0B9B,QAAA,QAAQ,GAAG;IACtB,uCAAkB;IAClB,+BAAc;IACd,qCAAiB;IACjB,qCAAiB;IACjB,uCAAkB;IAClB,uCAAkB;IAClB,+CAAsB;IACtB,+CAAsB;IACtB,6CAAqB;IACrB,6CAAqB;IACrB,iCAAe;IACf,iCAAe;IACf,+BAAc;IACd,+BAAc;IACd,uCAAkB;IAClB,uCAAkB;IAClB,+BAAc;IACd,6DAA4B;IAC5B,6DAA4B;IAC5B,yBAAW;IACX,yBAAW;IACX,yBAAW;IACX,yBAAW;CACZ,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/index.ts"],"names":[],"mappings":";;;AAAA,6DAAyD;AACzD,qDAAiD;AACjD,2DAAuD;AACvD,2DAAuD;AACvD,6DAAyD;AACzD,6DAAyD;AACzD,qEAAiE;AACjE,qEAAiE;AACjE,mEAA+D;AAC/D,mEAA+D;AAC/D,uDAAmD;AACnD,uDAAmD;AACnD,qDAAiD;AACjD,qDAAiD;AACjD,6DAAyD;AACzD,6DAAyD;AACzD,6DAAyD;AACzD,qDAAiD;AACjD,qFAA+E;AAC/E,qFAA+E;AAC/E,qFAA+E;AAC/E,+CAA2C;AAC3C,+CAA2C;AAC3C,+CAA2C;AAC3C,+CAA2C;AAC3C,+CAA2C;AAC3C,+CAA2C;AA8B9B,QAAA,QAAQ,GAAG;IACtB,uCAAkB;IAClB,+BAAc;IACd,qCAAiB;IACjB,qCAAiB;IACjB,uCAAkB;IAClB,uCAAkB;IAClB,+CAAsB;IACtB,+CAAsB;IACtB,6CAAqB;IACrB,6CAAqB;IACrB,iCAAe;IACf,iCAAe;IACf,+BAAc;IACd,+BAAc;IACd,uCAAkB;IAClB,uCAAkB;IAClB,uCAAkB;IAClB,+BAAc;IACd,6DAA4B;IAC5B,6DAA4B;IAC5B,6DAA4B;IAC5B,yBAAW;IACX,yBAAW;IACX,yBAAW;IACX,yBAAW;IACX,yBAAW;IACX,yBAAW;CACZ,CAAA"}
@@ -1,12 +1,11 @@
1
1
  import { type Webhook } from '@awell-health/extensions-core';
2
2
  import { type HealthieWebhookPayload } from '../lib/types';
3
- import { type settings } from '../settings';
4
3
  declare const dataPoints: {
5
4
  createdLabOrderId: {
6
5
  key: string;
7
6
  valueType: "string";
8
7
  };
9
8
  };
10
- export declare const labOrderCreated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload, typeof settings>;
9
+ export declare const labOrderCreated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload>;
11
10
  export type LabOrderCreated = typeof labOrderCreated;
12
11
  export {};
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.labOrderCreated = void 0;
4
4
  const lodash_1 = require("lodash");
5
- const types_1 = require("../lib/types");
6
- const errors_1 = require("../lib/sdk/errors");
7
- const createSdk_1 = require("../lib/sdk/createSdk");
8
5
  const dataPoints = {
9
6
  createdLabOrderId: {
10
7
  key: 'createdLabOrderId',
@@ -15,28 +12,19 @@ exports.labOrderCreated = {
15
12
  key: 'labOrderCreated',
16
13
  dataPoints,
17
14
  onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
18
- var _a, _b, _c;
19
- try {
20
- const { sdk } = await (0, createSdk_1.createSdk)({ settings });
21
- const createdLabOrderId = payload.resource_id.toString();
22
- const response = await sdk.getLabOrder({ id: createdLabOrderId });
23
- const healthiePatientId = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.labOrder) === null || _b === void 0 ? void 0 : _b.patient) === null || _c === void 0 ? void 0 : _c.id;
15
+ const { resource_id: createdLabOrderId } = payload;
16
+ if ((0, lodash_1.isNil)(createdLabOrderId)) {
17
+ await onError({
18
+ // We should automatically send a 400 here, so no need to provide info
19
+ });
20
+ }
21
+ else {
24
22
  await onSuccess({
25
23
  data_points: {
26
24
  createdLabOrderId,
27
25
  },
28
- ...(!(0, lodash_1.isNil)(healthiePatientId) && {
29
- patient_identifier: {
30
- system: types_1.HEALTHIE_IDENTIFIER,
31
- value: healthiePatientId,
32
- },
33
- }),
34
26
  });
35
27
  }
36
- catch (error) {
37
- const formattedError = (0, errors_1.formatErrors)(error);
38
- await onError(formattedError);
39
- }
40
28
  },
41
29
  };
42
30
  //# sourceMappingURL=labOrderCreated.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"labOrderCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/labOrderCreated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAK9B,wCAA+E;AAE/E,8CAAgD;AAChD,oDAAgD;AAEhD,MAAM,UAAU,GAAG;IACjB,iBAAiB,EAAE;QACjB,GAAG,EAAE,mBAAmB;QACxB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,eAAe,GAIxB;IACF,GAAG,EAAE,iBAAiB;IACtB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;;QACrE,IAAI;YACF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAA,qBAAS,EAAC,EAAC,QAAQ,EAAC,CAAC,CAAA;YAC3C,MAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAA;YAExD,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAA;YACjE,MAAM,iBAAiB,GAAG,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,QAAQ,0CAAE,OAAO,0CAAE,EAAE,CAAA;YAC/D,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACX,iBAAiB;iBAClB;gBACD,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,iBAAiB,CAAC,IAAI;oBAC/B,kBAAkB,EAAE;wBAClB,MAAM,EAAE,2BAAmB;wBAC3B,KAAK,EAAE,iBAAiB;qBACzB;iBACF,CAAC;aACH,CAAC,CAAA;SACH;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,cAAc,GAAG,IAAA,qBAAY,EAAC,KAAK,CAAC,CAAA;YAC1C,MAAM,OAAO,CAAC,cAAc,CAAC,CAAA;SAC9B;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"labOrderCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/labOrderCreated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAO9B,MAAM,UAAU,GAAG;IACjB,iBAAiB,EAAE;QACjB,GAAG,EAAE,mBAAmB;QACxB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,eAAe,GAGxB;IACF,GAAG,EAAE,iBAAiB;IACtB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACrE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAA;QAElD,IAAI,IAAA,cAAK,EAAC,iBAAiB,CAAC,EAAE;YAC5B,MAAM,OAAO,CAAC;YACZ,sEAAsE;aACvE,CAAC,CAAA;SACH;aAAM;YACL,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACX,iBAAiB;iBAClB;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF,CAAA"}
@@ -1,12 +1,11 @@
1
1
  import { type Webhook } from '@awell-health/extensions-core';
2
2
  import { type HealthieWebhookPayload } from '../lib/types';
3
- import { type settings } from '../settings';
4
3
  declare const dataPoints: {
5
4
  updatedLabOrderId: {
6
5
  key: string;
7
6
  valueType: "string";
8
7
  };
9
8
  };
10
- export declare const labOrderUpdated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload, typeof settings>;
9
+ export declare const labOrderUpdated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload>;
11
10
  export type LabOrderUpdated = typeof labOrderUpdated;
12
11
  export {};
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.labOrderUpdated = void 0;
4
4
  const lodash_1 = require("lodash");
5
- const types_1 = require("../lib/types");
6
- const errors_1 = require("../lib/sdk/errors");
7
- const createSdk_1 = require("../lib/sdk/createSdk");
8
5
  const dataPoints = {
9
6
  updatedLabOrderId: {
10
7
  key: 'updatedLabOrderId',
@@ -15,28 +12,19 @@ exports.labOrderUpdated = {
15
12
  key: 'labOrderUpdated',
16
13
  dataPoints,
17
14
  onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
18
- var _a, _b, _c;
19
- try {
20
- const { sdk } = await (0, createSdk_1.createSdk)({ settings });
21
- const updatedLabOrderId = payload.resource_id.toString();
22
- const response = await sdk.getLabOrder({ id: updatedLabOrderId });
23
- const healthiePatientId = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.labOrder) === null || _b === void 0 ? void 0 : _b.patient) === null || _c === void 0 ? void 0 : _c.id;
15
+ const { resource_id: updatedLabOrderId } = payload;
16
+ if ((0, lodash_1.isNil)(updatedLabOrderId)) {
17
+ await onError({
18
+ // We should automatically send a 400 here, so no need to provide info
19
+ });
20
+ }
21
+ else {
24
22
  await onSuccess({
25
23
  data_points: {
26
24
  updatedLabOrderId,
27
25
  },
28
- ...(!(0, lodash_1.isNil)(healthiePatientId) && {
29
- patient_identifier: {
30
- system: types_1.HEALTHIE_IDENTIFIER,
31
- value: healthiePatientId,
32
- },
33
- }),
34
26
  });
35
27
  }
36
- catch (error) {
37
- const formattedError = (0, errors_1.formatErrors)(error);
38
- await onError(formattedError);
39
- }
40
28
  },
41
29
  };
42
30
  //# sourceMappingURL=labOrderUpdated.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"labOrderUpdated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/labOrderUpdated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAK9B,wCAA+E;AAE/E,8CAAgD;AAChD,oDAAgD;AAEhD,MAAM,UAAU,GAAG;IACjB,iBAAiB,EAAE;QACjB,GAAG,EAAE,mBAAmB;QACxB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,eAAe,GAIxB;IACF,GAAG,EAAE,iBAAiB;IACtB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;;QACrE,IAAI;YACF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAA,qBAAS,EAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;YAC7C,MAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAA;YAExD,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAA;YACjE,MAAM,iBAAiB,GAAG,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,QAAQ,0CAAE,OAAO,0CAAE,EAAE,CAAA;YAC/D,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACV,iBAAiB;iBAClB;gBACF,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,iBAAiB,CAAC,IAAI;oBAC/B,kBAAkB,EAAE;wBAClB,MAAM,EAAE,2BAAmB;wBAC3B,KAAK,EAAE,iBAAiB;qBACzB;iBACF,CAAC;aACH,CAAC,CAAA;SACH;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,cAAc,GAAG,IAAA,qBAAY,EAAC,KAAK,CAAC,CAAA;YAC1C,MAAM,OAAO,CAAC,cAAc,CAAC,CAAA;SAC9B;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"labOrderUpdated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/labOrderUpdated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAO9B,MAAM,UAAU,GAAG;IACjB,iBAAiB,EAAE;QACjB,GAAG,EAAE,mBAAmB;QACxB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,eAAe,GAGxB;IACF,GAAG,EAAE,iBAAiB;IACtB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACrE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAA;QAElD,IAAI,IAAA,cAAK,EAAC,iBAAiB,CAAC,EAAE;YAC5B,MAAM,OAAO,CAAC;YACZ,sEAAsE;aACvE,CAAC,CAAA;SACH;aAAM;YACL,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACX,iBAAiB;iBAClB;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF,CAAA"}
@@ -1,12 +1,11 @@
1
1
  import { type Webhook } from '@awell-health/extensions-core';
2
2
  import { type HealthieWebhookPayload } from '../lib/types';
3
- import { type settings } from '../settings';
4
3
  declare const dataPoints: {
5
4
  createdMessageId: {
6
5
  key: string;
7
6
  valueType: "string";
8
7
  };
9
8
  };
10
- export declare const messageCreated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload, typeof settings>;
9
+ export declare const messageCreated: Webhook<keyof typeof dataPoints, HealthieWebhookPayload>;
11
10
  export type MessageCreated = typeof messageCreated;
12
11
  export {};
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.messageCreated = void 0;
4
4
  const lodash_1 = require("lodash");
5
- const types_1 = require("../lib/types");
6
- const errors_1 = require("../lib/sdk/errors");
7
- const createSdk_1 = require("../lib/sdk/createSdk");
8
5
  const dataPoints = {
9
6
  createdMessageId: {
10
7
  key: 'createdMessageId',
@@ -15,29 +12,19 @@ exports.messageCreated = {
15
12
  key: 'messageCreated',
16
13
  dataPoints,
17
14
  onWebhookReceived: async ({ payload, settings }, onSuccess, onError) => {
18
- var _a, _b, _c, _d;
19
- try {
20
- const { sdk } = await (0, createSdk_1.createSdk)({ settings });
21
- const createdMessageId = payload.resource_id.toString();
22
- const messageResponse = await sdk.getMessage({ id: createdMessageId });
23
- const conversationResponse = await sdk.getConversation({ id: (_b = (_a = messageResponse === null || messageResponse === void 0 ? void 0 : messageResponse.data) === null || _a === void 0 ? void 0 : _a.note) === null || _b === void 0 ? void 0 : _b.conversation_id });
24
- const healthiePatientId = (_d = (_c = conversationResponse === null || conversationResponse === void 0 ? void 0 : conversationResponse.data) === null || _c === void 0 ? void 0 : _c.conversation) === null || _d === void 0 ? void 0 : _d.patient_id;
15
+ const { resource_id: createdMessageId } = payload;
16
+ if ((0, lodash_1.isNil)(createdMessageId)) {
17
+ await onError({
18
+ // We should automatically send a 400 here, so no need to provide info
19
+ });
20
+ }
21
+ else {
25
22
  await onSuccess({
26
23
  data_points: {
27
24
  createdMessageId,
28
25
  },
29
- ...(!(0, lodash_1.isNil)(healthiePatientId) && {
30
- patient_identifier: {
31
- system: types_1.HEALTHIE_IDENTIFIER,
32
- value: healthiePatientId,
33
- }
34
- })
35
26
  });
36
27
  }
37
- catch (error) {
38
- const formattedError = (0, errors_1.formatErrors)(error);
39
- await onError(formattedError);
40
- }
41
28
  },
42
29
  };
43
30
  //# sourceMappingURL=messageCreated.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"messageCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/messageCreated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAK9B,wCAA+E;AAE/E,8CAAgD;AAChD,oDAAgD;AAEhD,MAAM,UAAU,GAAG;IACjB,gBAAgB,EAAE;QAChB,GAAG,EAAE,kBAAkB;QACvB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,cAAc,GAIvB;IACF,GAAG,EAAE,gBAAgB;IACrB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;;QACrE,IAAI;YACF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAA,qBAAS,EAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;YAC7C,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAA;YAEvD,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAA;YACtE,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,eAAe,CAAC,EAAE,EAAE,EAAE,MAAA,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI,0CAAE,IAAI,0CAAE,eAAe,EAAE,CAAC,CAAA;YAC5G,MAAM,iBAAiB,GAAG,MAAA,MAAA,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,0CAAE,YAAY,0CAAE,UAAU,CAAA;YAC9E,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACX,gBAAgB;iBACjB;gBACD,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,iBAAiB,CAAC,IAAI;oBAC/B,kBAAkB,EAAE;wBAClB,MAAM,EAAE,2BAAmB;wBAC3B,KAAK,EAAE,iBAAiB;qBACzB;iBACF,CAAC;aACH,CAAC,CAAA;SACH;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,cAAc,GAAG,IAAA,qBAAY,EAAC,KAAK,CAAC,CAAA;YAC1C,MAAM,OAAO,CAAC,cAAc,CAAC,CAAA;SAC9B;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"messageCreated.js","sourceRoot":"","sources":["../../../../extensions/healthie/webhooks/messageCreated.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAO9B,MAAM,UAAU,GAAG;IACjB,gBAAgB,EAAE;QAChB,GAAG,EAAE,kBAAkB;QACvB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,cAAc,GAGvB;IACF,GAAG,EAAE,gBAAgB;IACrB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACrE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAA;QAEjD,IAAI,IAAA,cAAK,EAAC,gBAAgB,CAAC,EAAE;YAC3B,MAAM,OAAO,CAAC;YACZ,sEAAsE;aACvE,CAAC,CAAA;SACH;aAAM;YACL,MAAM,SAAS,CAAC;gBACd,WAAW,EAAE;oBACX,gBAAgB;iBACjB;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF,CAAA"}