@metriport/shared 0.8.0 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/common/date.d.ts +2 -1
  2. package/dist/common/date.d.ts.map +1 -1
  3. package/dist/common/date.js +5 -3
  4. package/dist/common/date.js.map +1 -1
  5. package/dist/common/file-downloader.d.ts +14 -0
  6. package/dist/common/file-downloader.d.ts.map +1 -0
  7. package/dist/common/file-downloader.js +63 -0
  8. package/dist/common/file-downloader.js.map +1 -0
  9. package/dist/common/net.d.ts +2 -0
  10. package/dist/common/net.d.ts.map +1 -0
  11. package/dist/common/net.js +16 -0
  12. package/dist/common/net.js.map +1 -0
  13. package/dist/common/stream.d.ts +6 -0
  14. package/dist/common/stream.d.ts.map +1 -0
  15. package/dist/common/stream.js +18 -0
  16. package/dist/common/stream.js.map +1 -0
  17. package/dist/common/uuid.d.ts +2 -0
  18. package/dist/common/uuid.d.ts.map +1 -0
  19. package/dist/common/uuid.js +5 -0
  20. package/dist/common/uuid.js.map +1 -0
  21. package/dist/index.d.ts +5 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +19 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/medical/fhir/bundle.d.ts +5 -0
  26. package/dist/medical/fhir/bundle.d.ts.map +1 -0
  27. package/dist/medical/fhir/bundle.js +3 -0
  28. package/dist/medical/fhir/bundle.js.map +1 -0
  29. package/dist/medical/index.d.ts +4 -0
  30. package/dist/medical/index.d.ts.map +1 -0
  31. package/dist/medical/index.js +20 -0
  32. package/dist/medical/index.js.map +1 -0
  33. package/dist/medical/webhook/webhook-request.d.ts +464 -0
  34. package/dist/medical/webhook/webhook-request.d.ts.map +1 -0
  35. package/dist/medical/webhook/webhook-request.js +109 -0
  36. package/dist/medical/webhook/webhook-request.js.map +1 -0
  37. package/dist/medical/webhook/webhook-status-response.d.ts +7 -0
  38. package/dist/medical/webhook/webhook-status-response.d.ts.map +1 -0
  39. package/dist/medical/webhook/webhook-status-response.js +3 -0
  40. package/dist/medical/webhook/webhook-status-response.js.map +1 -0
  41. package/dist/net/__tests__/another.d.ts +1 -0
  42. package/dist/net/__tests__/another.d.ts.map +1 -0
  43. package/dist/net/__tests__/another.js +2 -0
  44. package/dist/net/__tests__/another.js.map +1 -0
  45. package/dist/net/__tests__/file-downloader.d.ts +2 -0
  46. package/dist/net/__tests__/file-downloader.d.ts.map +1 -0
  47. package/dist/net/__tests__/file-downloader.js +66 -0
  48. package/dist/net/__tests__/file-downloader.js.map +1 -0
  49. package/dist/net/file-downloader.d.ts +22 -0
  50. package/dist/net/file-downloader.d.ts.map +1 -0
  51. package/dist/net/file-downloader.js +67 -0
  52. package/dist/net/file-downloader.js.map +1 -0
  53. package/dist/net/net.d.ts +2 -0
  54. package/dist/net/net.d.ts.map +1 -0
  55. package/dist/net/net.js +16 -0
  56. package/dist/net/net.js.map +1 -0
  57. package/dist/net/stream.d.ts +6 -0
  58. package/dist/net/stream.d.ts.map +1 -0
  59. package/dist/net/stream.js +18 -0
  60. package/dist/net/stream.js.map +1 -0
  61. package/dist/net/url.d.ts +2 -0
  62. package/dist/net/url.d.ts.map +1 -0
  63. package/dist/net/url.js +16 -0
  64. package/dist/net/url.js.map +1 -0
  65. package/package.json +7 -3
@@ -0,0 +1,464 @@
1
+ import { z, ZodError, ZodFormattedError } from "zod";
2
+ import { SearchSetBundle } from "../fhir/bundle";
3
+ export declare const pingWebhookTypeSchema: z.ZodLiteral<"ping">;
4
+ export type PingWebhookType = z.infer<typeof pingWebhookTypeSchema>;
5
+ export declare const consolidatedWebhookTypeSchema: z.ZodLiteral<"medical.consolidated-data">;
6
+ export type ConsolidatedWebhookType = z.infer<typeof consolidatedWebhookTypeSchema>;
7
+ export declare const docDownloadWebhookTypeSchema: z.ZodLiteral<"medical.document-download">;
8
+ export type DocumentDownloadWebhookType = z.infer<typeof docDownloadWebhookTypeSchema>;
9
+ export declare const docConversionWebhookTypeSchema: z.ZodLiteral<"medical.document-conversion">;
10
+ export type DocumentConversionWebhookType = z.infer<typeof docConversionWebhookTypeSchema>;
11
+ export declare const docBulkDownloadWebhookTypeSchema: z.ZodLiteral<"medical.document-bulk-download-urls">;
12
+ export type DocumentBulkDownloadWebhookType = z.infer<typeof docBulkDownloadWebhookTypeSchema>;
13
+ export declare const mapiWebhookTypeSchema: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"medical.consolidated-data">, z.ZodLiteral<"medical.consolidated-data">]>, z.ZodLiteral<"medical.document-download">]>, z.ZodLiteral<"medical.document-conversion">]>, z.ZodLiteral<"medical.document-bulk-download-urls">]>;
14
+ export type MAPIWebhookType = z.infer<typeof mapiWebhookTypeSchema>;
15
+ export declare const webhookTypeSchema: z.ZodUnion<[z.ZodLiteral<"ping">, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"medical.consolidated-data">, z.ZodLiteral<"medical.consolidated-data">]>, z.ZodLiteral<"medical.document-download">]>, z.ZodLiteral<"medical.document-conversion">]>, z.ZodLiteral<"medical.document-bulk-download-urls">]>]>;
16
+ export type WebhookType = z.infer<typeof webhookTypeSchema>;
17
+ export declare const webhookRequestStatus: readonly ["processing", "success", "failure"];
18
+ export type WebhookRequestStatus = (typeof webhookRequestStatus)[number];
19
+ export declare const baseWebhookMetadataSchema: z.ZodObject<{
20
+ messageId: z.ZodString;
21
+ when: z.ZodEffects<z.ZodString, string, string>;
22
+ /**
23
+ * The metadata sent by the customer when they triggered the operation that resulted in this webhook.
24
+ */
25
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ messageId: string;
28
+ when: string;
29
+ data?: unknown;
30
+ }, {
31
+ messageId: string;
32
+ when: string;
33
+ data?: unknown;
34
+ }>;
35
+ export declare const webhookMetadataSchema: z.ZodObject<{
36
+ messageId: z.ZodString;
37
+ when: z.ZodEffects<z.ZodString, string, string>;
38
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
39
+ type: z.ZodString;
40
+ }, "strip", z.ZodTypeAny, {
41
+ type: string;
42
+ messageId: string;
43
+ when: string;
44
+ data?: unknown;
45
+ }, {
46
+ type: string;
47
+ messageId: string;
48
+ when: string;
49
+ data?: unknown;
50
+ }>;
51
+ export type WebhookMetadata = z.infer<typeof webhookMetadataSchema>;
52
+ export declare const pingWebhookRequestDataSchema: z.ZodObject<{
53
+ meta: z.ZodObject<{
54
+ messageId: z.ZodString;
55
+ when: z.ZodEffects<z.ZodString, string, string>;
56
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
57
+ type: z.ZodLiteral<"ping">;
58
+ }, "strip", z.ZodTypeAny, {
59
+ type: "ping";
60
+ messageId: string;
61
+ when: string;
62
+ data?: unknown;
63
+ }, {
64
+ type: "ping";
65
+ messageId: string;
66
+ when: string;
67
+ data?: unknown;
68
+ }>;
69
+ ping: z.ZodString;
70
+ }, "strip", z.ZodTypeAny, {
71
+ meta: {
72
+ type: "ping";
73
+ messageId: string;
74
+ when: string;
75
+ data?: unknown;
76
+ };
77
+ ping: string;
78
+ }, {
79
+ meta: {
80
+ type: "ping";
81
+ messageId: string;
82
+ when: string;
83
+ data?: unknown;
84
+ };
85
+ ping: string;
86
+ }>;
87
+ export type PingWebhookRequest = z.infer<typeof pingWebhookRequestDataSchema>;
88
+ export declare const filtersSchema: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
89
+ export declare const consolidatedWebhookPatientSchema: z.ZodObject<{
90
+ patientId: z.ZodString;
91
+ status: z.ZodEnum<["completed", "failed"]>;
92
+ bundle: z.ZodType<SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined, z.ZodTypeDef, SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined>;
93
+ filters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNullable<z.ZodString>>>>>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ status: "completed" | "failed";
96
+ patientId: string;
97
+ bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
98
+ filters?: Record<string, string | null | undefined> | null | undefined;
99
+ }, {
100
+ status: "completed" | "failed";
101
+ patientId: string;
102
+ bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
103
+ filters?: Record<string, string | null | undefined> | null | undefined;
104
+ }>;
105
+ export type ConsolidatedWebhookPatient = z.infer<typeof consolidatedWebhookPatientSchema>;
106
+ export declare const consolidatedWebhookRequestSchema: z.ZodObject<{
107
+ meta: z.ZodObject<{
108
+ messageId: z.ZodString;
109
+ when: z.ZodEffects<z.ZodString, string, string>;
110
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
111
+ type: z.ZodLiteral<"medical.consolidated-data">;
112
+ }, "strip", z.ZodTypeAny, {
113
+ type: "medical.consolidated-data";
114
+ messageId: string;
115
+ when: string;
116
+ data?: unknown;
117
+ }, {
118
+ type: "medical.consolidated-data";
119
+ messageId: string;
120
+ when: string;
121
+ data?: unknown;
122
+ }>;
123
+ patients: z.ZodArray<z.ZodObject<{
124
+ patientId: z.ZodString;
125
+ status: z.ZodEnum<["completed", "failed"]>;
126
+ bundle: z.ZodType<SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined, z.ZodTypeDef, SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined>;
127
+ filters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNullable<z.ZodString>>>>>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ status: "completed" | "failed";
130
+ patientId: string;
131
+ bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
132
+ filters?: Record<string, string | null | undefined> | null | undefined;
133
+ }, {
134
+ status: "completed" | "failed";
135
+ patientId: string;
136
+ bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
137
+ filters?: Record<string, string | null | undefined> | null | undefined;
138
+ }>, "many">;
139
+ }, "strip", z.ZodTypeAny, {
140
+ meta: {
141
+ type: "medical.consolidated-data";
142
+ messageId: string;
143
+ when: string;
144
+ data?: unknown;
145
+ };
146
+ patients: {
147
+ status: "completed" | "failed";
148
+ patientId: string;
149
+ bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
150
+ filters?: Record<string, string | null | undefined> | null | undefined;
151
+ }[];
152
+ }, {
153
+ meta: {
154
+ type: "medical.consolidated-data";
155
+ messageId: string;
156
+ when: string;
157
+ data?: unknown;
158
+ };
159
+ patients: {
160
+ status: "completed" | "failed";
161
+ patientId: string;
162
+ bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
163
+ filters?: Record<string, string | null | undefined> | null | undefined;
164
+ }[];
165
+ }>;
166
+ export type ConsolidatedWebhookRequest = z.infer<typeof consolidatedWebhookRequestSchema>;
167
+ export declare const documentDownloadWebhookRequestSchema: z.ZodObject<{
168
+ meta: z.ZodObject<{
169
+ messageId: z.ZodString;
170
+ when: z.ZodEffects<z.ZodString, string, string>;
171
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
172
+ type: z.ZodLiteral<"medical.document-download">;
173
+ }, "strip", z.ZodTypeAny, {
174
+ type: "medical.document-download";
175
+ messageId: string;
176
+ when: string;
177
+ data?: unknown;
178
+ }, {
179
+ type: "medical.document-download";
180
+ messageId: string;
181
+ when: string;
182
+ data?: unknown;
183
+ }>;
184
+ }, "strip", z.ZodTypeAny, {
185
+ meta: {
186
+ type: "medical.document-download";
187
+ messageId: string;
188
+ when: string;
189
+ data?: unknown;
190
+ };
191
+ }, {
192
+ meta: {
193
+ type: "medical.document-download";
194
+ messageId: string;
195
+ when: string;
196
+ data?: unknown;
197
+ };
198
+ }>;
199
+ export type DocumentDownloadWebhookRequest = z.infer<typeof documentDownloadWebhookRequestSchema>;
200
+ export declare const documentConversionWebhookRequestSchema: z.ZodObject<{
201
+ meta: z.ZodObject<{
202
+ messageId: z.ZodString;
203
+ when: z.ZodEffects<z.ZodString, string, string>;
204
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
205
+ type: z.ZodLiteral<"medical.document-conversion">;
206
+ }, "strip", z.ZodTypeAny, {
207
+ type: "medical.document-conversion";
208
+ messageId: string;
209
+ when: string;
210
+ data?: unknown;
211
+ }, {
212
+ type: "medical.document-conversion";
213
+ messageId: string;
214
+ when: string;
215
+ data?: unknown;
216
+ }>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ meta: {
219
+ type: "medical.document-conversion";
220
+ messageId: string;
221
+ when: string;
222
+ data?: unknown;
223
+ };
224
+ }, {
225
+ meta: {
226
+ type: "medical.document-conversion";
227
+ messageId: string;
228
+ when: string;
229
+ data?: unknown;
230
+ };
231
+ }>;
232
+ export type DocumentConversionWebhookRequest = z.infer<typeof documentConversionWebhookRequestSchema>;
233
+ export declare const documentBulkDownloadWebhookRequestSchema: z.ZodObject<{
234
+ meta: z.ZodObject<{
235
+ messageId: z.ZodString;
236
+ when: z.ZodEffects<z.ZodString, string, string>;
237
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
238
+ type: z.ZodLiteral<"medical.document-bulk-download-urls">;
239
+ }, "strip", z.ZodTypeAny, {
240
+ type: "medical.document-bulk-download-urls";
241
+ messageId: string;
242
+ when: string;
243
+ data?: unknown;
244
+ }, {
245
+ type: "medical.document-bulk-download-urls";
246
+ messageId: string;
247
+ when: string;
248
+ data?: unknown;
249
+ }>;
250
+ }, "strip", z.ZodTypeAny, {
251
+ meta: {
252
+ type: "medical.document-bulk-download-urls";
253
+ messageId: string;
254
+ when: string;
255
+ data?: unknown;
256
+ };
257
+ }, {
258
+ meta: {
259
+ type: "medical.document-bulk-download-urls";
260
+ messageId: string;
261
+ when: string;
262
+ data?: unknown;
263
+ };
264
+ }>;
265
+ export type DocumentBulkDownloadWebhookRequest = z.infer<typeof documentBulkDownloadWebhookRequestSchema>;
266
+ export declare const webhookRequestSchema: z.ZodUnion<[z.ZodObject<{
267
+ meta: z.ZodObject<{
268
+ messageId: z.ZodString;
269
+ when: z.ZodEffects<z.ZodString, string, string>;
270
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
271
+ type: z.ZodLiteral<"ping">;
272
+ }, "strip", z.ZodTypeAny, {
273
+ type: "ping";
274
+ messageId: string;
275
+ when: string;
276
+ data?: unknown;
277
+ }, {
278
+ type: "ping";
279
+ messageId: string;
280
+ when: string;
281
+ data?: unknown;
282
+ }>;
283
+ ping: z.ZodString;
284
+ }, "strip", z.ZodTypeAny, {
285
+ meta: {
286
+ type: "ping";
287
+ messageId: string;
288
+ when: string;
289
+ data?: unknown;
290
+ };
291
+ ping: string;
292
+ }, {
293
+ meta: {
294
+ type: "ping";
295
+ messageId: string;
296
+ when: string;
297
+ data?: unknown;
298
+ };
299
+ ping: string;
300
+ }>, z.ZodObject<{
301
+ meta: z.ZodObject<{
302
+ messageId: z.ZodString;
303
+ when: z.ZodEffects<z.ZodString, string, string>;
304
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
305
+ type: z.ZodLiteral<"medical.consolidated-data">;
306
+ }, "strip", z.ZodTypeAny, {
307
+ type: "medical.consolidated-data";
308
+ messageId: string;
309
+ when: string;
310
+ data?: unknown;
311
+ }, {
312
+ type: "medical.consolidated-data";
313
+ messageId: string;
314
+ when: string;
315
+ data?: unknown;
316
+ }>;
317
+ patients: z.ZodArray<z.ZodObject<{
318
+ patientId: z.ZodString;
319
+ status: z.ZodEnum<["completed", "failed"]>;
320
+ bundle: z.ZodType<SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined, z.ZodTypeDef, SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined>;
321
+ filters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNullable<z.ZodString>>>>>;
322
+ }, "strip", z.ZodTypeAny, {
323
+ status: "completed" | "failed";
324
+ patientId: string;
325
+ bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
326
+ filters?: Record<string, string | null | undefined> | null | undefined;
327
+ }, {
328
+ status: "completed" | "failed";
329
+ patientId: string;
330
+ bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
331
+ filters?: Record<string, string | null | undefined> | null | undefined;
332
+ }>, "many">;
333
+ }, "strip", z.ZodTypeAny, {
334
+ meta: {
335
+ type: "medical.consolidated-data";
336
+ messageId: string;
337
+ when: string;
338
+ data?: unknown;
339
+ };
340
+ patients: {
341
+ status: "completed" | "failed";
342
+ patientId: string;
343
+ bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
344
+ filters?: Record<string, string | null | undefined> | null | undefined;
345
+ }[];
346
+ }, {
347
+ meta: {
348
+ type: "medical.consolidated-data";
349
+ messageId: string;
350
+ when: string;
351
+ data?: unknown;
352
+ };
353
+ patients: {
354
+ status: "completed" | "failed";
355
+ patientId: string;
356
+ bundle?: SearchSetBundle<import("@medplum/fhirtypes").Resource> | undefined;
357
+ filters?: Record<string, string | null | undefined> | null | undefined;
358
+ }[];
359
+ }>, z.ZodObject<{
360
+ meta: z.ZodObject<{
361
+ messageId: z.ZodString;
362
+ when: z.ZodEffects<z.ZodString, string, string>;
363
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
364
+ type: z.ZodLiteral<"medical.document-download">;
365
+ }, "strip", z.ZodTypeAny, {
366
+ type: "medical.document-download";
367
+ messageId: string;
368
+ when: string;
369
+ data?: unknown;
370
+ }, {
371
+ type: "medical.document-download";
372
+ messageId: string;
373
+ when: string;
374
+ data?: unknown;
375
+ }>;
376
+ }, "strip", z.ZodTypeAny, {
377
+ meta: {
378
+ type: "medical.document-download";
379
+ messageId: string;
380
+ when: string;
381
+ data?: unknown;
382
+ };
383
+ }, {
384
+ meta: {
385
+ type: "medical.document-download";
386
+ messageId: string;
387
+ when: string;
388
+ data?: unknown;
389
+ };
390
+ }>, z.ZodObject<{
391
+ meta: z.ZodObject<{
392
+ messageId: z.ZodString;
393
+ when: z.ZodEffects<z.ZodString, string, string>;
394
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
395
+ type: z.ZodLiteral<"medical.document-conversion">;
396
+ }, "strip", z.ZodTypeAny, {
397
+ type: "medical.document-conversion";
398
+ messageId: string;
399
+ when: string;
400
+ data?: unknown;
401
+ }, {
402
+ type: "medical.document-conversion";
403
+ messageId: string;
404
+ when: string;
405
+ data?: unknown;
406
+ }>;
407
+ }, "strip", z.ZodTypeAny, {
408
+ meta: {
409
+ type: "medical.document-conversion";
410
+ messageId: string;
411
+ when: string;
412
+ data?: unknown;
413
+ };
414
+ }, {
415
+ meta: {
416
+ type: "medical.document-conversion";
417
+ messageId: string;
418
+ when: string;
419
+ data?: unknown;
420
+ };
421
+ }>, z.ZodObject<{
422
+ meta: z.ZodObject<{
423
+ messageId: z.ZodString;
424
+ when: z.ZodEffects<z.ZodString, string, string>;
425
+ data: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
426
+ type: z.ZodLiteral<"medical.document-bulk-download-urls">;
427
+ }, "strip", z.ZodTypeAny, {
428
+ type: "medical.document-bulk-download-urls";
429
+ messageId: string;
430
+ when: string;
431
+ data?: unknown;
432
+ }, {
433
+ type: "medical.document-bulk-download-urls";
434
+ messageId: string;
435
+ when: string;
436
+ data?: unknown;
437
+ }>;
438
+ }, "strip", z.ZodTypeAny, {
439
+ meta: {
440
+ type: "medical.document-bulk-download-urls";
441
+ messageId: string;
442
+ when: string;
443
+ data?: unknown;
444
+ };
445
+ }, {
446
+ meta: {
447
+ type: "medical.document-bulk-download-urls";
448
+ messageId: string;
449
+ when: string;
450
+ data?: unknown;
451
+ };
452
+ }>]>;
453
+ export type WebhookRequest = z.infer<typeof webhookRequestSchema>;
454
+ export declare class WebhookRequestParsingError {
455
+ readonly errors: ZodError<WebhookRequest>;
456
+ readonly flattened: ZodFormattedError<WebhookRequest>;
457
+ constructor(errors: ZodError<WebhookRequest>, flattened: ZodFormattedError<WebhookRequest>);
458
+ }
459
+ export declare function isPingWebhookRequest(whRequest: WebhookRequest): whRequest is PingWebhookRequest;
460
+ export declare function isConsolidatedWebhookRequest(whRequest: WebhookRequest): whRequest is ConsolidatedWebhookRequest;
461
+ export declare function isDocumentDownloadWebhookRequest(whRequest: WebhookRequest): whRequest is DocumentDownloadWebhookRequest;
462
+ export declare function isDocumentConversionWebhookRequest(whRequest: WebhookRequest): whRequest is DocumentConversionWebhookRequest;
463
+ export declare function isDocumentBulkDownloadWebhookRequest(whRequest: WebhookRequest): whRequest is DocumentBulkDownloadWebhookRequest;
464
+ //# sourceMappingURL=webhook-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-request.d.ts","sourceRoot":"","sources":["../../../src/medical/webhook/webhook-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,eAAO,MAAM,qBAAqB,sBAAoB,CAAC;AACvD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,6BAA6B,2CAAyC,CAAC;AACpF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,4BAA4B,2CAAyC,CAAC;AACnF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEvF,eAAO,MAAM,8BAA8B,6CAA2C,CAAC;AACvF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAE3F,eAAO,MAAM,gCAAgC,qDAAmD,CAAC;AACjG,MAAM,MAAM,+BAA+B,GAAG,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AkC,CAChD,SAAS,EAAE,cAAc,GACxB,SAAS,IAAI,gCAAgC,CAK/C;AAED,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,cAAc,GACxB,SAAS,IAAI,kCAAkC,CAKjD"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDocumentBulkDownloadWebhookRequest = exports.isDocumentConversionWebhookRequest = exports.isDocumentDownloadWebhookRequest = exports.isConsolidatedWebhookRequest = exports.isPingWebhookRequest = exports.WebhookRequestParsingError = exports.webhookRequestSchema = exports.documentBulkDownloadWebhookRequestSchema = exports.documentConversionWebhookRequestSchema = exports.documentDownloadWebhookRequestSchema = exports.consolidatedWebhookRequestSchema = exports.consolidatedWebhookPatientSchema = exports.filtersSchema = exports.pingWebhookRequestDataSchema = exports.webhookMetadataSchema = exports.baseWebhookMetadataSchema = exports.webhookRequestStatus = exports.webhookTypeSchema = exports.mapiWebhookTypeSchema = exports.docBulkDownloadWebhookTypeSchema = exports.docConversionWebhookTypeSchema = exports.docDownloadWebhookTypeSchema = exports.consolidatedWebhookTypeSchema = exports.pingWebhookTypeSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const date_1 = require("../../common/date");
6
+ exports.pingWebhookTypeSchema = zod_1.z.literal(`ping`);
7
+ exports.consolidatedWebhookTypeSchema = zod_1.z.literal(`medical.consolidated-data`);
8
+ exports.docDownloadWebhookTypeSchema = zod_1.z.literal(`medical.document-download`);
9
+ exports.docConversionWebhookTypeSchema = zod_1.z.literal(`medical.document-conversion`);
10
+ exports.docBulkDownloadWebhookTypeSchema = zod_1.z.literal(`medical.document-bulk-download-urls`);
11
+ exports.mapiWebhookTypeSchema = exports.consolidatedWebhookTypeSchema
12
+ .or(exports.consolidatedWebhookTypeSchema)
13
+ .or(exports.docDownloadWebhookTypeSchema)
14
+ .or(exports.docConversionWebhookTypeSchema)
15
+ .or(exports.docBulkDownloadWebhookTypeSchema);
16
+ exports.webhookTypeSchema = exports.pingWebhookTypeSchema.or(exports.mapiWebhookTypeSchema);
17
+ exports.webhookRequestStatus = ["processing", "success", "failure"];
18
+ exports.baseWebhookMetadataSchema = zod_1.z.object({
19
+ messageId: zod_1.z.string(),
20
+ when: date_1.dateSchema,
21
+ /**
22
+ * The metadata sent by the customer when they triggered the operation that resulted in this webhook.
23
+ */
24
+ data: zod_1.z.unknown().nullish(),
25
+ });
26
+ exports.webhookMetadataSchema = exports.baseWebhookMetadataSchema.merge(zod_1.z.object({
27
+ type: zod_1.z.string(),
28
+ }));
29
+ function createWebhookMetadataSchema(itemSchema) {
30
+ return exports.baseWebhookMetadataSchema.merge(zod_1.z.object({
31
+ type: itemSchema,
32
+ }));
33
+ }
34
+ exports.pingWebhookRequestDataSchema = zod_1.z.object({
35
+ meta: createWebhookMetadataSchema(exports.pingWebhookTypeSchema),
36
+ ping: zod_1.z.string(),
37
+ });
38
+ exports.filtersSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.string().nullish());
39
+ exports.consolidatedWebhookPatientSchema = zod_1.z.object({
40
+ patientId: zod_1.z.string(),
41
+ status: zod_1.z.enum(["completed", "failed"]),
42
+ bundle: zod_1.z.custom(),
43
+ filters: exports.filtersSchema.nullish(),
44
+ });
45
+ exports.consolidatedWebhookRequestSchema = zod_1.z.object({
46
+ meta: createWebhookMetadataSchema(exports.consolidatedWebhookTypeSchema),
47
+ patients: exports.consolidatedWebhookPatientSchema.array(),
48
+ });
49
+ // TODO Implement
50
+ exports.documentDownloadWebhookRequestSchema = zod_1.z.object({
51
+ meta: createWebhookMetadataSchema(exports.docDownloadWebhookTypeSchema),
52
+ });
53
+ // TODO Implement
54
+ exports.documentConversionWebhookRequestSchema = zod_1.z.object({
55
+ meta: createWebhookMetadataSchema(exports.docConversionWebhookTypeSchema),
56
+ });
57
+ // TODO Implement
58
+ exports.documentBulkDownloadWebhookRequestSchema = zod_1.z.object({
59
+ meta: createWebhookMetadataSchema(exports.docBulkDownloadWebhookTypeSchema),
60
+ });
61
+ exports.webhookRequestSchema = zod_1.z.union([
62
+ exports.pingWebhookRequestDataSchema,
63
+ exports.consolidatedWebhookRequestSchema,
64
+ exports.documentDownloadWebhookRequestSchema,
65
+ exports.documentConversionWebhookRequestSchema,
66
+ exports.documentBulkDownloadWebhookRequestSchema,
67
+ ]);
68
+ class WebhookRequestParsingError {
69
+ constructor(errors, flattened) {
70
+ this.errors = errors;
71
+ this.flattened = flattened;
72
+ }
73
+ }
74
+ exports.WebhookRequestParsingError = WebhookRequestParsingError;
75
+ function isPingWebhookRequest(whRequest) {
76
+ if (whRequest.meta.type === "ping")
77
+ return true;
78
+ return false;
79
+ }
80
+ exports.isPingWebhookRequest = isPingWebhookRequest;
81
+ function isConsolidatedWebhookRequest(whRequest) {
82
+ if (whRequest.meta.type === "medical.consolidated-data") {
83
+ return true;
84
+ }
85
+ return false;
86
+ }
87
+ exports.isConsolidatedWebhookRequest = isConsolidatedWebhookRequest;
88
+ function isDocumentDownloadWebhookRequest(whRequest) {
89
+ if (whRequest.meta.type === "medical.document-download") {
90
+ return true;
91
+ }
92
+ return false;
93
+ }
94
+ exports.isDocumentDownloadWebhookRequest = isDocumentDownloadWebhookRequest;
95
+ function isDocumentConversionWebhookRequest(whRequest) {
96
+ if (whRequest.meta.type === "medical.document-conversion") {
97
+ return true;
98
+ }
99
+ return false;
100
+ }
101
+ exports.isDocumentConversionWebhookRequest = isDocumentConversionWebhookRequest;
102
+ function isDocumentBulkDownloadWebhookRequest(whRequest) {
103
+ if (whRequest.meta.type === "medical.document-bulk-download-urls") {
104
+ return true;
105
+ }
106
+ return false;
107
+ }
108
+ exports.isDocumentBulkDownloadWebhookRequest = isDocumentBulkDownloadWebhookRequest;
109
+ //# sourceMappingURL=webhook-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-request.js","sourceRoot":"","sources":["../../../src/medical/webhook/webhook-request.ts"],"names":[],"mappings":";;;AAAA,6BAAqD;AACrD,4CAA+C;AAGlC,QAAA,qB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YACW,MAAgC,EAChC,SAA4C;QAD5C,WAAM,GAAN,MAAM,CAA0B;QAChC,cAAS,GAAT,SAAS,CAAmC;IACpD,CAAC;CACL;AALD,gEAKC;AAED,SAAgB,oBAAoB,CAAC,SAAyB;IAC5D,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAChD,OAAO,KAAK,CAAC;AACf,CAAC;AAHD,oDAGC;AAED,SAAgB,4BAA4B,CAC1C,SAAyB;IAEzB,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,2BAA2B,EAAE;QACvD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,oEAOC;AAED,SAAgB,gCAAgC,CAC9C,SAAyB;IAEzB,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,2BAA2B,EAAE;QACvD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,4EAOC;AAED,SAAgB,kCAAkC,CAChD,SAAyB;IAEzB,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,6BAA6B,EAAE;QACzD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,gFAOC;AAED,SAAgB,oCAAoC,CAClD,SAAyB;IAEzB,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,qCAAqC,EAAE;QACjE,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,oFAOC"}
@@ -0,0 +1,7 @@
1
+ export interface WebhookStatusResponse {
2
+ webhookEnabled: boolean;
3
+ webhookStatusDetail?: string;
4
+ webhookRequestsProcessing: number;
5
+ webhookRequestsFailed: number;
6
+ }
7
+ //# sourceMappingURL=webhook-status-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-status-response.d.ts","sourceRoot":"","sources":["../../../src/medical/webhook/webhook-status-response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;CAC/B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=webhook-status-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-status-response.js","sourceRoot":"","sources":["../../../src/medical/webhook/webhook-status-response.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=another.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"another.d.ts","sourceRoot":"","sources":["../../../src/net/__tests__/another.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=another.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"another.js","sourceRoot":"","sources":["../../../src/net/__tests__/another.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=file-downloader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-downloader.d.ts","sourceRoot":"","sources":["../../../src/net/__tests__/file-downloader.ts"],"names":[],"mappings":""}