@awell-health/awell-extensions 1.0.76 → 1.0.78

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.
@@ -501,6 +501,62 @@ export declare const actions: {
501
501
  type: import("@awell-health/extensions-core").FieldType.STRING;
502
502
  required: true;
503
503
  };
504
+ is_recurring: {
505
+ id: string;
506
+ label: string;
507
+ description: string;
508
+ type: import("@awell-health/extensions-core").FieldType.BOOLEAN;
509
+ required: false;
510
+ };
511
+ frequency: {
512
+ id: string;
513
+ label: string;
514
+ description: string;
515
+ type: import("@awell-health/extensions-core").FieldType.STRING;
516
+ required: false;
517
+ };
518
+ period: {
519
+ id: string;
520
+ label: string;
521
+ description: string;
522
+ type: import("@awell-health/extensions-core").FieldType.STRING;
523
+ required: false;
524
+ };
525
+ hour: {
526
+ id: string;
527
+ label: string;
528
+ description: string;
529
+ type: import("@awell-health/extensions-core").FieldType.NUMERIC;
530
+ required: false;
531
+ };
532
+ minute: {
533
+ id: string;
534
+ label: string;
535
+ description: string;
536
+ type: import("@awell-health/extensions-core").FieldType.NUMERIC;
537
+ required: false;
538
+ };
539
+ weekday: {
540
+ id: string;
541
+ label: string;
542
+ description: string;
543
+ type: import("@awell-health/extensions-core").FieldType.STRING;
544
+ required: false;
545
+ };
546
+ monthday: {
547
+ id: string;
548
+ label: string;
549
+ description: string;
550
+ type: import("@awell-health/extensions-core").FieldType.STRING;
551
+ required: false;
552
+ };
553
+ ends_on: {
554
+ id: string;
555
+ label: string;
556
+ description: string;
557
+ type: import("@awell-health/extensions-core").FieldType.DATE;
558
+ required: false;
559
+ };
504
560
  }, {
505
561
  apiUrl: {
506
562
  key: string;
@@ -15,6 +15,62 @@ declare const fields: {
15
15
  type: FieldType.STRING;
16
16
  required: true;
17
17
  };
18
+ is_recurring: {
19
+ id: string;
20
+ label: string;
21
+ description: string;
22
+ type: FieldType.BOOLEAN;
23
+ required: false;
24
+ };
25
+ frequency: {
26
+ id: string;
27
+ label: string;
28
+ description: string;
29
+ type: FieldType.STRING;
30
+ required: false;
31
+ };
32
+ period: {
33
+ id: string;
34
+ label: string;
35
+ description: string;
36
+ type: FieldType.STRING;
37
+ required: false;
38
+ };
39
+ hour: {
40
+ id: string;
41
+ label: string;
42
+ description: string;
43
+ type: FieldType.NUMERIC;
44
+ required: false;
45
+ };
46
+ minute: {
47
+ id: string;
48
+ label: string;
49
+ description: string;
50
+ type: FieldType.NUMERIC;
51
+ required: false;
52
+ };
53
+ weekday: {
54
+ id: string;
55
+ label: string;
56
+ description: string;
57
+ type: FieldType.STRING;
58
+ required: false;
59
+ };
60
+ monthday: {
61
+ id: string;
62
+ label: string;
63
+ description: string;
64
+ type: FieldType.STRING;
65
+ required: false;
66
+ };
67
+ ends_on: {
68
+ id: string;
69
+ label: string;
70
+ description: string;
71
+ type: FieldType.DATE;
72
+ required: false;
73
+ };
18
74
  };
19
75
  export declare const sendFormCompletionRequest: Action<typeof fields, typeof settings>;
20
76
  export {};
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendFormCompletionRequest = void 0;
4
- const lodash_1 = require("lodash");
5
4
  const errors_1 = require("../errors");
6
5
  const extensions_core_1 = require("@awell-health/extensions-core");
7
6
  const extensions_core_2 = require("@awell-health/extensions-core");
8
7
  const sdk_1 = require("../gql/sdk");
9
8
  const graphqlClient_1 = require("../graphqlClient");
9
+ const sendFormCompletionRequest_zod_1 = require("../validation/sendFormCompletionRequest.zod");
10
+ const lodash_1 = require("lodash");
10
11
  const fields = {
11
12
  healthie_patient_id: {
12
13
  id: 'healthie_patient_id',
@@ -22,6 +23,62 @@ const fields = {
22
23
  type: extensions_core_1.FieldType.STRING,
23
24
  required: true,
24
25
  },
26
+ is_recurring: {
27
+ id: 'is_recurring',
28
+ label: 'Is recurring',
29
+ description: 'Set to true if the Form completion should be recurring.',
30
+ type: extensions_core_1.FieldType.BOOLEAN,
31
+ required: false,
32
+ },
33
+ frequency: {
34
+ id: 'frequency',
35
+ label: 'Frequency',
36
+ description: 'Required if "Is recurring" is set to true. Valid options are: Daily, Weekly, Monthly.',
37
+ type: extensions_core_1.FieldType.STRING,
38
+ required: false,
39
+ },
40
+ period: {
41
+ id: 'period',
42
+ label: 'Period',
43
+ description: 'AM or PM.',
44
+ type: extensions_core_1.FieldType.STRING,
45
+ required: false,
46
+ },
47
+ hour: {
48
+ id: 'hour',
49
+ label: 'Hour',
50
+ description: 'For instance, if you want to trigger the completion request at 1:05 PM, use "1".',
51
+ type: extensions_core_1.FieldType.NUMERIC,
52
+ required: false,
53
+ },
54
+ minute: {
55
+ id: 'minute',
56
+ label: 'Minute',
57
+ description: 'For instance, if you want to trigger the completion request at 1:05 PM, use "5".',
58
+ type: extensions_core_1.FieldType.NUMERIC,
59
+ required: false,
60
+ },
61
+ weekday: {
62
+ id: 'weekday',
63
+ label: 'Weekday',
64
+ description: 'Use the full weekday name, e.g. "Monday".',
65
+ type: extensions_core_1.FieldType.STRING,
66
+ required: false,
67
+ },
68
+ monthday: {
69
+ id: 'monthday',
70
+ label: 'Monthday',
71
+ description: 'Number of the day of month, e.g. "27th".',
72
+ type: extensions_core_1.FieldType.STRING,
73
+ required: false,
74
+ },
75
+ ends_on: {
76
+ id: 'ends_on',
77
+ label: 'Ends on',
78
+ description: 'Recurrence end date in the YYYY-MM-DD format.',
79
+ type: extensions_core_1.FieldType.DATE,
80
+ required: false,
81
+ },
25
82
  };
26
83
  exports.sendFormCompletionRequest = {
27
84
  key: 'sendFormCompletionRequest',
@@ -32,23 +89,8 @@ exports.sendFormCompletionRequest = {
32
89
  previewable: true,
33
90
  onActivityCreated: async (payload, onComplete, onError) => {
34
91
  const { fields, settings } = payload;
35
- const { healthie_patient_id, form_id } = fields;
36
92
  try {
37
- if ((0, lodash_1.isNil)(healthie_patient_id) || (0, lodash_1.isNil)(form_id)) {
38
- await onError({
39
- events: [
40
- {
41
- date: new Date().toISOString(),
42
- text: { en: 'Fields are missing' },
43
- error: {
44
- category: 'MISSING_FIELDS',
45
- message: '`healthie_patient_id` or `form_id` is missing',
46
- },
47
- },
48
- ],
49
- });
50
- return;
51
- }
93
+ const { healthie_patient_id, form_id, is_recurring, frequency, monthday, weekday, hour, minute, period, ends_on, } = sendFormCompletionRequest_zod_1.FieldsSchema.parse(fields);
52
94
  const client = (0, graphqlClient_1.initialiseClient)(settings);
53
95
  if (client !== undefined) {
54
96
  const sdk = (0, sdk_1.getSdk)(client);
@@ -63,6 +105,15 @@ exports.sendFormCompletionRequest = {
63
105
  */
64
106
  recipient_ids: healthie_patient_id,
65
107
  form: form_id,
108
+ is_recurring: is_recurring !== null && is_recurring !== void 0 ? is_recurring : false,
109
+ frequency,
110
+ monthday,
111
+ weekday,
112
+ hour,
113
+ minute,
114
+ period,
115
+ recurrence_ends: !(0, lodash_1.isNil)(ends_on),
116
+ ends_on,
66
117
  },
67
118
  });
68
119
  await onComplete();
@@ -1 +1 @@
1
- {"version":3,"file":"sendFormCompletionRequest.js","sourceRoot":"","sources":["../../../../extensions/healthie/actions/sendFormCompletionRequest.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,sCAAqE;AACrE,mEAIsC;AACtC,mEAAwD;AACxD,oCAAmC;AACnC,oDAAmD;AAGnD,MAAM,MAAM,GAAG;IACb,mBAAmB,EAAE;QACnB,EAAE,EAAE,qBAAqB;QACzB,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,wEAAwE;QAC1E,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,4DAA4D;QACzE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEpB,QAAA,yBAAyB,GACpC;IACE,GAAG,EAAE,2BAA2B;IAChC,QAAQ,EAAE,0BAAQ,CAAC,g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AAE,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":"sendFormCompletionRequest.js","sourceRoot":"","sources":["../../../../extensions/healthie/actions/sendFormCompletionRequest.ts"],"names":[],"mappings":";;;AAAA,sCAAqE;AACrE,mEAIsC;AACtC,mEAAwD;AACxD,oCAAmC;AACnC,oDAAmD;AAEnD,+FAA0E;AAC1E,mCAA8B;AAE9B,MAAM,MAAM,GAAG;IACb,mBAAmB,EAAE;QACnB,EAAE,EAAE,qBAAqB;QACzB,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,wEAAwE;QAC1E,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,4DAA4D;QACzE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,YAAY,EAAE;QACZ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AE,EAAE,EAAE,4CAA4C,EAAE;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"}
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ export declare const FieldsSchema: z.ZodEffects<z.ZodObject<{
3
+ healthie_patient_id: z.ZodString;
4
+ form_id: z.ZodString;
5
+ is_recurring: z.ZodOptional<z.ZodBoolean>;
6
+ frequency: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
7
+ period: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
8
+ minute: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
9
+ hour: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
10
+ weekday: z.ZodUnion<[z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
11
+ monthday: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
12
+ ends_on: z.ZodUnion<[z.ZodOptional<z.ZodEffects<z.ZodDate, string, Date>>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ healthie_patient_id: string;
15
+ form_id: string;
16
+ is_recurring?: boolean | undefined;
17
+ frequency?: string | undefined;
18
+ period?: string | undefined;
19
+ minute?: string | undefined;
20
+ hour?: string | undefined;
21
+ weekday?: string | undefined;
22
+ monthday?: string | undefined;
23
+ ends_on?: string | undefined;
24
+ }, {
25
+ healthie_patient_id: string;
26
+ form_id: string;
27
+ is_recurring?: boolean | undefined;
28
+ frequency?: string | undefined;
29
+ period?: string | undefined;
30
+ minute?: string | undefined;
31
+ hour?: string | undefined;
32
+ weekday?: string | undefined;
33
+ monthday?: string | undefined;
34
+ ends_on?: "" | Date | undefined;
35
+ }>, {
36
+ healthie_patient_id: string;
37
+ form_id: string;
38
+ is_recurring?: boolean | undefined;
39
+ frequency?: string | undefined;
40
+ period?: string | undefined;
41
+ minute?: string | undefined;
42
+ hour?: string | undefined;
43
+ weekday?: string | undefined;
44
+ monthday?: string | undefined;
45
+ ends_on?: string | undefined;
46
+ }, {
47
+ healthie_patient_id: string;
48
+ form_id: string;
49
+ is_recurring?: boolean | undefined;
50
+ frequency?: string | undefined;
51
+ period?: string | undefined;
52
+ minute?: string | undefined;
53
+ hour?: string | undefined;
54
+ weekday?: string | undefined;
55
+ monthday?: string | undefined;
56
+ ends_on?: "" | Date | undefined;
57
+ }>;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldsSchema = void 0;
4
+ const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const lodash_1 = require("lodash");
6
+ const zod_1 = require("zod");
7
+ const periodEnum = zod_1.z.enum(['AM', 'PM']);
8
+ const frequencyEnum = zod_1.z.enum(['Daily', 'Weekly', 'Monthly']);
9
+ const weekdayEnum = zod_1.z.enum([
10
+ 'Monday',
11
+ 'Tuesday',
12
+ 'Wednesday',
13
+ 'Thursday',
14
+ 'Friday',
15
+ 'Saturday',
16
+ 'Sunday',
17
+ ]);
18
+ // healthie doesn't validate correct form and can lead to errors - validation on our side
19
+ const monthdayEnum = zod_1.z.enum([
20
+ '1st',
21
+ '2nd',
22
+ '3rd',
23
+ '4th',
24
+ '5th',
25
+ '6th',
26
+ '7th',
27
+ '8th',
28
+ '9th',
29
+ '10th',
30
+ '11th',
31
+ '12th',
32
+ '13th',
33
+ '14th',
34
+ '15th',
35
+ '16th',
36
+ '17th',
37
+ '18th',
38
+ '19th',
39
+ '20th',
40
+ '21st',
41
+ '22nd',
42
+ '23rd',
43
+ '24th',
44
+ '25th',
45
+ '26th',
46
+ '27th',
47
+ '28th',
48
+ '29th',
49
+ '30th',
50
+ '31st',
51
+ ]);
52
+ const recurringSchema = zod_1.z.discriminatedUnion('frequency', [
53
+ /**
54
+ * If `frequency` is "daily"
55
+ * then "period", "hour" and "minute" are required
56
+ */
57
+ zod_1.z.object({
58
+ frequency: zod_1.z.literal(frequencyEnum.enum.Daily),
59
+ hour: zod_1.z.coerce.number().min(1).max(12).transform(String),
60
+ minute: zod_1.z.coerce.number().min(0).max(59).transform(String),
61
+ period: periodEnum,
62
+ }),
63
+ /**
64
+ * If `frequency` is "weekly"
65
+ * then "weekday" is required
66
+ */
67
+ zod_1.z.object({
68
+ frequency: zod_1.z.literal(frequencyEnum.enum.Weekly),
69
+ weekday: weekdayEnum,
70
+ }),
71
+ /**
72
+ * If `frequency` is "monthly"
73
+ * then "monthday" is required
74
+ */
75
+ zod_1.z.object({
76
+ frequency: zod_1.z.literal(frequencyEnum.enum.Monthly),
77
+ monthday: monthdayEnum,
78
+ }),
79
+ ]);
80
+ exports.FieldsSchema = zod_1.z
81
+ .object({
82
+ healthie_patient_id: zod_1.z.string().nonempty(),
83
+ form_id: zod_1.z.string().nonempty(),
84
+ is_recurring: zod_1.z.boolean().optional(),
85
+ frequency: zod_1.z.string().transform(lodash_1.capitalize).optional(),
86
+ period: (0, extensions_core_1.makeStringOptional)(zod_1.z.string().toUpperCase()),
87
+ minute: (0, extensions_core_1.makeStringOptional)(zod_1.z.coerce.string()),
88
+ hour: (0, extensions_core_1.makeStringOptional)(zod_1.z.coerce.string()),
89
+ weekday: (0, extensions_core_1.makeStringOptional)(zod_1.z.string().transform(lodash_1.capitalize)),
90
+ monthday: (0, extensions_core_1.makeStringOptional)(zod_1.z.string().toLowerCase()),
91
+ ends_on: extensions_core_1.DateOnlyOptionalSchema,
92
+ })
93
+ .superRefine(({ healthie_patient_id, form_id, is_recurring, frequency, monthday, weekday, hour, minute, period, ends_on, }, ctx) => {
94
+ // if is recurring, then check
95
+ if (is_recurring === true) {
96
+ recurringSchema.parse({
97
+ frequency,
98
+ hour,
99
+ minute,
100
+ period,
101
+ weekday,
102
+ monthday,
103
+ });
104
+ }
105
+ });
106
+ //# sourceMappingURL=sendFormCompletionRequest.zod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendFormCompletionRequest.zod.js","sourceRoot":"","sources":["../../../../extensions/healthie/validation/sendFormCompletionRequest.zod.ts"],"names":[],"mappings":";;;AAAA,mEAGsC;AACtC,mCAAmC;AACnC,6BAAuB;AAEvB,MAAM,UAAU,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AACvC,MAAM,aAAa,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAA;AAC5D,MAAM,WAAW,GAAG,OAAC,CAAC,IAAI,CAAC;IACzB,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;IACV,QAAQ;CACT,CAAC,CAAA;AACF,yFAAyF;AACzF,M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ensions",
3
- "version": "1.0.76",
3
+ "version": "1.0.78",
4
4
  "packageManager": "yarn@3.4.1",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {