@awell-health/awell-extensions 2.0.93 → 2.0.95

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,6 +21,13 @@ export declare const fields: {
21
21
  description: string;
22
22
  type: FieldType.STRING;
23
23
  };
24
+ dob: {
25
+ id: string;
26
+ label: string;
27
+ description: string;
28
+ type: FieldType.DATE;
29
+ required: false;
30
+ };
24
31
  email: {
25
32
  id: string;
26
33
  label: string;
@@ -53,6 +60,7 @@ export declare const FieldsValidationSchema: z.ZodObject<{
53
60
  last_name: z.ZodString;
54
61
  legal_name: z.ZodOptional<z.ZodString>;
55
62
  email: z.ZodOptional<z.ZodString>;
63
+ dob: z.ZodOptional<z.ZodString>;
56
64
  phone_number: z.ZodOptional<z.ZodString>;
57
65
  send_invite: z.ZodOptional<z.ZodBoolean>;
58
66
  provider_id: z.ZodOptional<z.ZodString>;
@@ -60,6 +68,7 @@ export declare const FieldsValidationSchema: z.ZodObject<{
60
68
  first_name: string;
61
69
  last_name: string;
62
70
  email?: string | undefined;
71
+ dob?: string | undefined;
63
72
  phone_number?: string | undefined;
64
73
  provider_id?: string | undefined;
65
74
  legal_name?: string | undefined;
@@ -68,8 +77,21 @@ export declare const FieldsValidationSchema: z.ZodObject<{
68
77
  first_name: string;
69
78
  last_name: string;
70
79
  email?: string | undefined;
80
+ dob?: string | undefined;
71
81
  phone_number?: string | undefined;
72
82
  provider_id?: string | undefined;
73
83
  legal_name?: string | undefined;
74
84
  send_invite?: boolean | undefined;
75
85
  }>;
86
+ export interface CreatePatientPayload {
87
+ first_name: string;
88
+ last_name: string;
89
+ legal_name?: string;
90
+ email?: string;
91
+ dob?: string;
92
+ skipped_email?: boolean;
93
+ phone_number?: string;
94
+ dietitian_id?: string;
95
+ user_group_id?: string;
96
+ dont_send_welcome?: boolean;
97
+ }
@@ -24,6 +24,13 @@ exports.fields = {
24
24
  description: "The patient's legal name which will be used in CMS 1500 Claims, Invoices, and Superbills.",
25
25
  type: extensions_core_1.FieldType.STRING,
26
26
  },
27
+ dob: {
28
+ id: 'dob',
29
+ label: 'Date of birth',
30
+ description: 'Date of birth of the patient',
31
+ type: extensions_core_1.FieldType.DATE,
32
+ required: false,
33
+ },
27
34
  email: {
28
35
  id: 'email',
29
36
  label: 'Email',
@@ -56,6 +63,7 @@ exports.FieldsValidationSchema = zod_1.z.object({
56
63
  last_name: zod_1.z.string().min(1),
57
64
  legal_name: zod_1.z.string().optional(),
58
65
  email: zod_1.z.string().optional(),
66
+ dob: zod_1.z.string().optional(),
59
67
  phone_number: zod_1.z.string().optional(),
60
68
  send_invite: zod_1.z.boolean().optional(),
61
69
  provider_id: zod_1.z.string().optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/actions/createPatient/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAIsC;AACtC,6BAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,gCAAgC;QAC7C,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,2FAA2F;QAC7F,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;IACD,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,WAAW,EACT,iIAAiI;QACnI,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,kCAAkC;QAC/C,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,UAAU,EAAE,4BAAU,CAAC,KAAK;KAC7B;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EACT,sEAAsE;QACxE,IAAI,EAAE,2BAAS,CAAC,OAAO;KACxB;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,2HAA2H;QAC7H,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACe,CAAC,CAAA"}
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/actions/createPatient/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAIsC;AACtC,6BAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,gCAAgC;QAC7C,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAA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AC;IAC5B,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACe,CAAC,CAAA"}
@@ -27,19 +27,23 @@ exports.createPatient = {
27
27
  : fields.provider_id;
28
28
  const skipped_email = fields.email === undefined || fields.email === ''; // if email is empty we still want to create the patient
29
29
  try {
30
+ const input = {
31
+ first_name: fields.first_name,
32
+ last_name: fields.last_name,
33
+ legal_name: fields.legal_name,
34
+ email: fields.email,
35
+ phone_number: fields.phone_number,
36
+ dob: fields.dob,
37
+ dietitian_id,
38
+ dont_send_welcome,
39
+ };
40
+ if (skipped_email) {
41
+ input.skipped_email = true;
42
+ }
30
43
  const res = await healthieSdk.client.mutation({
31
44
  createClient: {
32
45
  __args: {
33
- input: {
34
- first_name: fields.first_name,
35
- last_name: fields.last_name,
36
- legal_name: fields.legal_name,
37
- email: fields.email,
38
- phone_number: fields.phone_number,
39
- dietitian_id,
40
- skipped_email,
41
- dont_send_welcome,
42
- },
46
+ input,
43
47
  },
44
48
  user: {
45
49
  id: true,
@@ -1 +1 @@
1
- {"version":3,"file":"createPatient.js","sourceRoot":"","sources":["../../../../../extensions/healthie/actions/createPatient/createPatient.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEhC,mEAAwD;AAExD,iEAG6C;AAC7C,qCAAqE;AACrE,2FAAuF;AACvF,yCAGqB;AACR,QAAA,aAAa,GAItB;IACF,GAAG,EAAE,eAAe;IACpB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;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AAI,IAAA,gBAAO,EAAC,MAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,YAAY,0CAAE,IAAI,0CAAE,EAAE,CAAC;gBACtC,MAAM,IAAI,kCAAyB,CAAC,GAAG,CAAC,CAAA;YAE1C,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,iBAAiB,EAAE,MAAA,MAAA,GAAG,CAAC,YAAY,0CAAE,IAAI,0CAAE,EAAE;iBAC9C;aACF,CAAC,CAAA;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,YAAY,kCAAyB,EAAE;gBAC9C,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,CAAC,IAAA,4CAAmC,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;iBAC5D,CAAC,CAAA;aACH;iBAAM,IAAI,KAAK,YAAY,sBAAa,EAAE;gBACzC,MAAM,MAAM,GAAG,IAAA,mCAA0B,EAAC,KAAK,CAAC,MAAM,CAAC,CAAA;gBACvD,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,MAAM;iBACf,CAAC,CAAA;aACH;iBAAM;gBACL,MAAM,KAAK,CAAA;aACZ;SACF;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"createPatient.js","sourceRoot":"","sources":["../../../../../extensions/healthie/actions/createPatient/createPatient.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEhC,mEAAwD;AAExD,iEAG6C;AAC7C,qCAKiB;AACjB,2FAAuF;AACvF,yCAGqB;AAER,QAAA,aAAa,GAItB;IACF,GAAG,EAAE,eAAe;IACpB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,+BAA+B;IAC5C,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EA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AE,IAAI,0CAAE,EAAE,CAAC;gBACtC,MAAM,IAAI,kCAAyB,CAAC,GAAG,CAAC,CAAA;YAE1C,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,iBAAiB,EAAE,MAAA,MAAA,GAAG,CAAC,YAAY,0CAAE,IAAI,0CAAE,EAAE;iBAC9C;aACF,CAAC,CAAA;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,YAAY,kCAAyB,EAAE;gBAC9C,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,CAAC,IAAA,4CAAmC,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;iBAC5D,CAAC,CAAA;aACH;iBAAM,IAAI,KAAK,YAAY,sBAAa,EAAE;gBACzC,MAAM,MAAM,GAAG,IAAA,mCAA0B,EAAC,KAAK,CAAC,MAAM,CAAC,CAAA;gBACvD,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,MAAM;iBACf,CAAC,CAAA;aACH;iBAAM;gBACL,MAAM,KAAK,CAAA;aACZ;SACF;IACH,CAAC;CACF,CAAA"}
@@ -298,6 +298,13 @@ export declare const actions: {
298
298
  description: string;
299
299
  type: import("@awell-health/extensions-core").FieldType.STRING;
300
300
  };
301
+ dob: {
302
+ id: string;
303
+ label: string;
304
+ description: string;
305
+ type: import("@awell-health/extensions-core").FieldType.DATE;
306
+ required: false;
307
+ };
301
308
  email: {
302
309
  id: string;
303
310
  label: string;
@@ -353,30 +360,35 @@ export declare const actions: {
353
360
  label: string;
354
361
  description: string;
355
362
  type: import("@awell-health/extensions-core").FieldType.STRING;
363
+ required: false;
356
364
  };
357
365
  last_name: {
358
366
  id: string;
359
367
  label: string;
360
368
  description: string;
361
369
  type: import("@awell-health/extensions-core").FieldType.STRING;
370
+ required: false;
362
371
  };
363
372
  legal_name: {
364
373
  id: string;
365
374
  label: string;
366
375
  description: string;
367
376
  type: import("@awell-health/extensions-core").FieldType.STRING;
377
+ required: false;
368
378
  };
369
379
  email: {
370
380
  id: string;
371
381
  label: string;
372
382
  description: string;
373
383
  type: import("@awell-health/extensions-core").FieldType.STRING;
384
+ required: false;
374
385
  };
375
386
  dob: {
376
387
  id: string;
377
388
  label: string;
378
389
  description: string;
379
390
  type: import("@awell-health/extensions-core").FieldType.DATE;
391
+ required: false;
380
392
  };
381
393
  phone_number: {
382
394
  id: string;
@@ -384,48 +396,63 @@ export declare const actions: {
384
396
  description: string;
385
397
  type: import("@awell-health/extensions-core").FieldType.STRING;
386
398
  stringType: import("@awell-health/extensions-core").StringType.PHONE;
399
+ required: false;
387
400
  };
388
401
  provider_id: {
389
402
  id: string;
390
403
  label: string;
391
404
  description: string;
392
405
  type: import("@awell-health/extensions-core").FieldType.STRING;
406
+ required: false;
393
407
  };
394
408
  user_group_id: {
395
409
  id: string;
396
410
  label: string;
397
411
  description: string;
398
412
  type: import("@awell-health/extensions-core").FieldType.STRING;
413
+ required: false;
399
414
  };
400
415
  active: {
401
416
  id: string;
402
417
  label: string;
403
418
  description: string;
404
419
  type: import("@awell-health/extensions-core").FieldType.BOOLEAN;
420
+ required: false;
405
421
  };
406
422
  height: {
407
423
  id: string;
408
424
  label: string;
409
425
  description: string;
410
426
  type: import("@awell-health/extensions-core").FieldType.STRING;
427
+ required: false;
411
428
  };
412
429
  gender: {
413
430
  id: string;
414
431
  label: string;
415
432
  description: string;
416
433
  type: import("@awell-health/extensions-core").FieldType.STRING;
434
+ required: false;
417
435
  };
418
436
  gender_identity: {
419
437
  id: string;
420
438
  label: string;
421
439
  description: string;
422
440
  type: import("@awell-health/extensions-core").FieldType.STRING;
441
+ required: false;
423
442
  };
424
443
  sex: {
425
444
  id: string;
426
445
  label: string;
427
446
  description: string;
428
447
  type: import("@awell-health/extensions-core").FieldType.STRING;
448
+ required: false;
449
+ };
450
+ resend_welcome_email: {
451
+ id: string;
452
+ label: string;
453
+ description: string;
454
+ type: import("@awell-health/extensions-core").FieldType.BOOLEAN;
455
+ required: false;
429
456
  };
430
457
  }, {
431
458
  apiUrl: {
@@ -1,4 +1,5 @@
1
1
  import { FieldType, StringType } from '@awell-health/extensions-core';
2
+ import { z } from 'zod';
2
3
  export declare const fields: {
3
4
  id: {
4
5
  id: string;
@@ -12,30 +13,35 @@ export declare const fields: {
12
13
  label: string;
13
14
  description: string;
14
15
  type: FieldType.STRING;
16
+ required: false;
15
17
  };
16
18
  last_name: {
17
19
  id: string;
18
20
  label: string;
19
21
  description: string;
20
22
  type: FieldType.STRING;
23
+ required: false;
21
24
  };
22
25
  legal_name: {
23
26
  id: string;
24
27
  label: string;
25
28
  description: string;
26
29
  type: FieldType.STRING;
30
+ required: false;
27
31
  };
28
32
  email: {
29
33
  id: string;
30
34
  label: string;
31
35
  description: string;
32
36
  type: FieldType.STRING;
37
+ required: false;
33
38
  };
34
39
  dob: {
35
40
  id: string;
36
41
  label: string;
37
42
  description: string;
38
43
  type: FieldType.DATE;
44
+ required: false;
39
45
  };
40
46
  phone_number: {
41
47
  id: string;
@@ -43,47 +49,129 @@ export declare const fields: {
43
49
  description: string;
44
50
  type: FieldType.STRING;
45
51
  stringType: StringType.PHONE;
52
+ required: false;
46
53
  };
47
54
  provider_id: {
48
55
  id: string;
49
56
  label: string;
50
57
  description: string;
51
58
  type: FieldType.STRING;
59
+ required: false;
52
60
  };
53
61
  user_group_id: {
54
62
  id: string;
55
63
  label: string;
56
64
  description: string;
57
65
  type: FieldType.STRING;
66
+ required: false;
58
67
  };
59
68
  active: {
60
69
  id: string;
61
70
  label: string;
62
71
  description: string;
63
72
  type: FieldType.BOOLEAN;
73
+ required: false;
64
74
  };
65
75
  height: {
66
76
  id: string;
67
77
  label: string;
68
78
  description: string;
69
79
  type: FieldType.STRING;
80
+ required: false;
70
81
  };
71
82
  gender: {
72
83
  id: string;
73
84
  label: string;
74
85
  description: string;
75
86
  type: FieldType.STRING;
87
+ required: false;
76
88
  };
77
89
  gender_identity: {
78
90
  id: string;
79
91
  label: string;
80
92
  description: string;
81
93
  type: FieldType.STRING;
94
+ required: false;
82
95
  };
83
96
  sex: {
84
97
  id: string;
85
98
  label: string;
86
99
  description: string;
87
100
  type: FieldType.STRING;
101
+ required: false;
102
+ };
103
+ resend_welcome_email: {
104
+ id: string;
105
+ label: string;
106
+ description: string;
107
+ type: FieldType.BOOLEAN;
108
+ required: false;
88
109
  };
89
110
  };
111
+ export interface UpdatePatientPayload {
112
+ id: string;
113
+ first_name?: string;
114
+ last_name?: string;
115
+ legal_name?: string;
116
+ email?: string;
117
+ skipped_email?: boolean;
118
+ dob?: string;
119
+ phone_number?: string;
120
+ dietitian_id?: string;
121
+ user_group_id?: string;
122
+ active?: boolean;
123
+ height?: string;
124
+ gender?: string;
125
+ gender_identity?: string;
126
+ sex?: string;
127
+ resend_welcome?: boolean;
128
+ }
129
+ export declare const FieldsValidationSchema: z.ZodObject<{
130
+ id: z.ZodString;
131
+ first_name: z.ZodOptional<z.ZodString>;
132
+ last_name: z.ZodOptional<z.ZodString>;
133
+ legal_name: z.ZodOptional<z.ZodString>;
134
+ email: z.ZodOptional<z.ZodString>;
135
+ dob: z.ZodOptional<z.ZodString>;
136
+ phone_number: z.ZodOptional<z.ZodString>;
137
+ provider_id: z.ZodOptional<z.ZodString>;
138
+ user_group_id: z.ZodOptional<z.ZodString>;
139
+ active: z.ZodOptional<z.ZodBoolean>;
140
+ height: z.ZodOptional<z.ZodString>;
141
+ gender: z.ZodOptional<z.ZodEnum<["Female", "Male", "Other"]>>;
142
+ gender_identity: z.ZodOptional<z.ZodString>;
143
+ sex: z.ZodOptional<z.ZodEnum<["Female", "Male"]>>;
144
+ resend_welcome_email: z.ZodOptional<z.ZodBoolean>;
145
+ }, "strip", z.ZodTypeAny, {
146
+ id: string;
147
+ email?: string | undefined;
148
+ dob?: string | undefined;
149
+ sex?: "Male" | "Female" | undefined;
150
+ first_name?: string | undefined;
151
+ last_name?: string | undefined;
152
+ phone_number?: string | undefined;
153
+ active?: boolean | undefined;
154
+ gender?: "Male" | "Female" | "Other" | undefined;
155
+ gender_identity?: string | undefined;
156
+ height?: string | undefined;
157
+ provider_id?: string | undefined;
158
+ legal_name?: string | undefined;
159
+ user_group_id?: string | undefined;
160
+ resend_welcome_email?: boolean | undefined;
161
+ }, {
162
+ id: string;
163
+ email?: string | undefined;
164
+ dob?: string | undefined;
165
+ sex?: "Male" | "Female" | undefined;
166
+ first_name?: string | undefined;
167
+ last_name?: string | undefined;
168
+ phone_number?: string | undefined;
169
+ active?: boolean | undefined;
170
+ gender?: "Male" | "Female" | "Other" | undefined;
171
+ gender_identity?: string | undefined;
172
+ height?: string | undefined;
173
+ provider_id?: string | undefined;
174
+ legal_name?: string | undefined;
175
+ user_group_id?: string | undefined;
176
+ resend_welcome_email?: boolean | undefined;
177
+ }>;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fields = void 0;
3
+ exports.FieldsValidationSchema = exports.fields = void 0;
4
4
  const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const zod_1 = require("zod");
5
6
  exports.fields = {
6
7
  id: {
7
8
  id: 'id',
@@ -15,30 +16,35 @@ exports.fields = {
15
16
  label: 'First name',
16
17
  description: 'The first name of the patient.',
17
18
  type: extensions_core_1.FieldType.STRING,
19
+ required: false,
18
20
  },
19
21
  last_name: {
20
22
  id: 'last_name',
21
23
  label: 'Last name',
22
24
  description: 'The last name of the patient.',
23
25
  type: extensions_core_1.FieldType.STRING,
26
+ required: false,
24
27
  },
25
28
  legal_name: {
26
29
  id: 'legal_name',
27
30
  label: 'Legal name',
28
31
  description: "The patient's legal name which will be used in CMS 1500 Claims, Invoices, and Superbills.",
29
32
  type: extensions_core_1.FieldType.STRING,
33
+ required: false,
30
34
  },
31
35
  email: {
32
36
  id: 'email',
33
37
  label: 'Email',
34
38
  description: 'The email address of the patient.',
35
39
  type: extensions_core_1.FieldType.STRING,
40
+ required: false,
36
41
  },
37
42
  dob: {
38
43
  id: 'dob',
39
44
  label: 'Date of birth',
40
45
  description: 'Date of birth of the patient',
41
46
  type: extensions_core_1.FieldType.DATE,
47
+ required: false,
42
48
  },
43
49
  phone_number: {
44
50
  id: 'phone_number',
@@ -46,48 +52,80 @@ exports.fields = {
46
52
  description: 'The phone number of the patient.',
47
53
  type: extensions_core_1.FieldType.STRING,
48
54
  stringType: extensions_core_1.StringType.PHONE,
55
+ required: false,
49
56
  },
50
57
  provider_id: {
51
58
  id: 'provider_id',
52
59
  label: 'Provider ID',
53
60
  description: 'This is the ID of the provider and defaults to the user the API key is associated with. Also known as the `dietitian_id`.',
54
61
  type: extensions_core_1.FieldType.STRING,
62
+ required: false,
55
63
  },
56
64
  user_group_id: {
57
65
  id: 'user_group_id',
58
66
  label: 'User group ID',
59
67
  description: 'The user group the patient belongs to.',
60
68
  type: extensions_core_1.FieldType.STRING,
69
+ required: false,
61
70
  },
62
71
  active: {
63
72
  id: 'active',
64
73
  label: 'Active',
65
74
  description: 'Whether the patient is still active.',
66
75
  type: extensions_core_1.FieldType.BOOLEAN,
76
+ required: false,
67
77
  },
68
78
  height: {
69
79
  id: 'height',
70
80
  label: 'Height',
71
81
  description: 'The height of the patient.',
72
82
  type: extensions_core_1.FieldType.STRING,
83
+ required: false,
73
84
  },
74
85
  gender: {
75
86
  id: 'gender',
76
87
  label: 'Gender',
77
88
  description: 'The gender of the patient. Either "Female", "Male", or "Other".',
78
89
  type: extensions_core_1.FieldType.STRING,
90
+ required: false,
79
91
  },
80
92
  gender_identity: {
81
93
  id: 'gender_identity',
82
94
  label: 'Gender identity',
83
95
  description: 'Should only be passed when gender is "Other"',
84
96
  type: extensions_core_1.FieldType.STRING,
97
+ required: false,
85
98
  },
86
99
  sex: {
87
100
  id: 'sex',
88
101
  label: 'Sex',
89
102
  description: 'The sex of the patient. Either "Female", "Male".',
90
103
  type: extensions_core_1.FieldType.STRING,
104
+ required: false,
105
+ },
106
+ resend_welcome_email: {
107
+ id: 'resend_welcome_email',
108
+ label: 'Resend welcome email',
109
+ description: 'Whether to resend the welcome email to the patient',
110
+ type: extensions_core_1.FieldType.BOOLEAN,
111
+ required: false,
91
112
  },
92
113
  };
114
+ exports.FieldsValidationSchema = zod_1.z.object({
115
+ id: zod_1.z.string().min(1),
116
+ first_name: zod_1.z.string().optional(),
117
+ last_name: zod_1.z.string().optional(),
118
+ legal_name: zod_1.z.string().optional(),
119
+ email: zod_1.z.string().optional(),
120
+ dob: zod_1.z.string().optional(),
121
+ phone_number: zod_1.z.string().optional(),
122
+ provider_id: zod_1.z.string().optional(),
123
+ user_group_id: zod_1.z.string().optional(),
124
+ active: zod_1.z.boolean().optional(),
125
+ height: zod_1.z.string().optional(),
126
+ gender: zod_1.z.enum(['Female', 'Male', 'Other']).optional(),
127
+ gender_identity: zod_1.z.string().optional(),
128
+ sex: zod_1.z.enum(['Female', 'Male']).optional(),
129
+ resend_welcome_email: zod_1.z.boolean().optional(),
130
+ });
93
131
  //# sourceMappingURL=fields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/actions/updatePatient/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAIsC;AAEzB,QAAA,MAAM,GAAG;IACpB,EAAE,EAAE;QACF,EAAE,EAAE,IAAI;QACR,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,oCAAoC;QACjD,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,gCAAgC;QAC7C,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,2FAA2F;QAC7F,IAAI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A8C;QAC3D,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;IACD,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,kDAAkD;QAC/D,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;CAC8B,CAAA"}
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/actions/updatePatient/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAIsC;AACtC,6BAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,EAAE,EAAE;QACF,EAAE,EAAE,IAAI;QACR,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,oCAAoC;QACjD,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,gCAAgC;QAC7C,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,2FAA2F;QAC7F,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,mCAAmC;QAChD,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,8BAA8B;QAC3C,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AAC,QAAQ,EAAE;IACtC,GAAG,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1C,oBAAoB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACK,CAAC,CAAA"}
@@ -1 +1 @@
1
- export { fields } from './fields';
1
+ export { fields, FieldsValidationSchema, type UpdatePatientPayload, } from './fields';
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fields = void 0;
3
+ exports.FieldsValidationSchema = exports.fields = void 0;
4
4
  var fields_1 = require("./fields");
5
5
  Object.defineProperty(exports, "fields", { enumerable: true, get: function () { return fields_1.fields; } });
6
+ Object.defineProperty(exports, "FieldsValidationSchema", { enumerable: true, get: function () { return fields_1.FieldsValidationSchema; } });
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/actions/updatePatient/config/index.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AAAxB,gGAAA,MAAM,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/actions/updatePatient/config/index.ts"],"names":[],"mappings":";;;AAAA,mCAIiB;AAHf,gGAAA,MAAM,OAAA;AACN,gHAAA,sBAAsB,OAAA"}
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updatePatient = void 0;
4
4
  const lodash_1 = require("lodash");
5
5
  const extensions_core_1 = require("@awell-health/extensions-core");
6
- const sdk_1 = require("../../lib/sdk/graphql-codegen/generated/sdk");
7
- const graphqlClient_1 = require("../../lib/sdk/graphql-codegen/graphqlClient");
6
+ const validatePayloadAndCreateSdk_1 = require("../../lib/sdk/validatePayloadAndCreateSdk");
8
7
  const errors_1 = require("../../lib/sdk/graphql-codegen/errors");
9
8
  const config_1 = require("./config");
9
+ const zod_1 = require("zod");
10
10
  exports.updatePatient = {
11
11
  key: 'updatePatient',
12
12
  category: extensions_core_1.Category.EHR_INTEGRATIONS,
@@ -14,63 +14,48 @@ exports.updatePatient = {
14
14
  description: 'Update a patient in Healthie.',
15
15
  fields: config_1.fields,
16
16
  previewable: true,
17
- onActivityCreated: async (payload, onComplete, onError) => {
18
- const { fields, settings } = payload;
19
- const { id, first_name, last_name, legal_name, email, phone_number, provider_id, gender, gender_identity, height, sex, user_group_id, active, dob, } = fields;
17
+ onEvent: async ({ payload, onComplete, onError }) => {
20
18
  try {
21
- if ((0, lodash_1.isNil)(id)) {
22
- await onError({
23
- events: [
24
- {
25
- date: new Date().toISOString(),
26
- text: { en: 'Fields are missing' },
27
- error: {
28
- category: 'MISSING_FIELDS',
29
- message: '`id` is missing',
30
- },
31
- },
32
- ],
33
- });
34
- return;
19
+ const { fields, healthieSdk } = await (0, validatePayloadAndCreateSdk_1.validatePayloadAndCreateSdk)({
20
+ fieldsSchema: config_1.FieldsValidationSchema,
21
+ payload,
22
+ });
23
+ const dietitian_id = fields.provider_id === '' || (0, lodash_1.isNil)(fields.provider_id)
24
+ ? undefined
25
+ : fields.provider_id;
26
+ const input = {
27
+ id: fields.id,
28
+ first_name: fields.first_name,
29
+ last_name: fields.last_name,
30
+ legal_name: fields.legal_name,
31
+ email: fields.email,
32
+ phone_number: fields.phone_number,
33
+ dietitian_id,
34
+ gender: fields.gender,
35
+ gender_identity: fields.gender_identity,
36
+ height: fields.height,
37
+ sex: fields.sex,
38
+ user_group_id: fields.user_group_id,
39
+ active: fields.active,
40
+ dob: fields.dob,
41
+ };
42
+ if (fields.resend_welcome_email === true) {
43
+ input.resend_welcome = true;
35
44
  }
36
- const client = (0, graphqlClient_1.initialiseClient)(settings);
37
- if (client !== undefined) {
38
- const sdk = (0, sdk_1.getSdk)(client);
39
- await sdk.updatePatient({
40
- input: {
41
- id,
42
- first_name,
43
- last_name,
44
- legal_name,
45
- email,
46
- phone_number,
47
- dietitian_id: provider_id === '' ? undefined : provider_id,
48
- gender,
49
- gender_identity,
50
- height,
51
- sex,
52
- user_group_id,
53
- active,
54
- dob,
55
- skipped_email: (0, lodash_1.isEmpty)(email),
45
+ await healthieSdk.client.mutation({
46
+ updateClient: {
47
+ __args: {
48
+ input,
56
49
  },
57
- });
58
- await onComplete();
59
- }
60
- else {
61
- await onError({
62
- events: [
63
- {
64
- date: new Date().toISOString(),
65
- text: { en: 'API client requires an API url and API key' },
66
- error: {
67
- category: 'MISSING_SETTINGS',
68
- message: 'Missing api url or api key',
69
- },
70
- },
71
- ],
72
- });
73
- }
50
+ user: {
51
+ id: true,
52
+ },
53
+ messages: {
54
+ __scalar: true,
55
+ },
56
+ },
57
+ });
58
+ await onComplete();
74
59
  }
75
60
  catch (err) {
76
61
  if (err instanceof errors_1.HealthieError) {
@@ -79,6 +64,9 @@ exports.updatePatient = {
79
64
  events: errors,
80
65
  });
81
66
  }
67
+ else if (err instanceof zod_1.ZodError) {
68
+ throw err;
69
+ }
82
70
  else {
83
71
  const error = err;
84
72
  await onError({
@@ -1 +1 @@
1
- {"version":3,"file":"updatePatient.js","sourceRoot":"","sources":["../../../../../extensions/healthie/actions/updatePatient/updatePatient.ts"],"names":[],"mappings":";;;AAAA,mCAAuC;AAEvC,mEAAwD;AACxD,qEAAoE;AACpE,+EAA8E;AAE9E,iEAG6C;AAC7C,qCAAiC;AAEpB,QAAA,aAAa,GAA2C;IACnE,GAAG,EAAE,eAAe;IACpB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,+BAA+B;IAC5C,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,EAAE;QACvE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;QACpC,MAAM,EACJ,EAAE,EACF,UAAU,EAC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AAE;4BAC1D,KAAK,EAAE;gCACL,QAAQ,EAAE,kBAAkB;gCAC5B,OAAO,EAAE,4BAA4B;6BACtC;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,YAAY,sBAAa,EAAE;gBAChC,MAAM,MAAM,GAAG,IAAA,mCAA0B,EAAC,GAAG,CAAC,MAAM,CAAC,CAAA;gBACrD,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,MAAM;iBACf,CAAC,CAAA;aACH;iBAAM;gBACL,MAAM,KAAK,GAAG,GAAY,CAAA;gBAC1B,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,gCAAgC,EAAE;4BAC9C,KAAK,EAAE;gCACL,QAAQ,EAAE,cAAc;gCACxB,OAAO,EAAE,KAAK,CAAC,OAAO;6BACvB;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;SACF;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"updatePatient.js","sourceRoot":"","sources":["../../../../../extensions/healthie/actions/updatePatient/updatePatient.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAE9B,mEAAwD;AACxD,2FAAuF;AAEvF,iEAG6C;AAC7C,qCAIiB;AACjB,6BAA8B;AAEjB,QAAA,aAAa,GAA2C;IACnE,GAAG,EAAE,eAAe;IACpB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,+BAA+B;IAC5C,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE;QAClD,IAAI;YACF,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,y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mCAA0B,EAAC,GAAG,CAAC,MAAM,CAAC,CAAA;gBACrD,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,MAAM;iBACf,CAAC,CAAA;aACH;iBAAM,IAAI,GAAG,YAAY,cAAQ,EAAE;gBAClC,MAAM,GAAG,CAAA;aACV;iBAAM;gBACL,MAAM,KAAK,GAAG,GAAY,CAAA;gBAC1B,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,gCAAgC,EAAE;4BAC9C,KAAK,EAAE;gCACL,QAAQ,EAAE,cAAc;gCACxB,OAAO,EAAE,KAAK,CAAC,OAAO;6BACvB;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;SACF;IACH,CAAC;CACF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.0.93",
3
+ "version": "2.0.95",
4
4
  "packageManager": "yarn@3.4.1",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {