@awell-health/awell-extensions 2.0.278 → 2.0.280

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.
@@ -32,7 +32,7 @@ exports.callCompleted = {
32
32
  callId,
33
33
  callObject: JSON.stringify(payload),
34
34
  },
35
- ...(awellPatientId && { patient_id: awellPatientId }),
35
+ ...(awellPatientId !== undefined && { patient_id: awellPatientId }),
36
36
  });
37
37
  },
38
38
  };
@@ -1 +1 @@
1
- {"version":3,"file":"callCompleted.js","sourceRoot":"","sources":["../../../../../extensions/bland/webhooks/CallCompleted/callCompleted.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAQ9B,MAAM,UAAU,GAAG;IACjB,MAAM,EAAE;QACN,GAAG,EAAE,QAAQ;QACb,SAAS,EAAE,QAAQ;KACpB;IACD,UAAU,EAAE;QACV,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,MAAM;KAClB;CAC4C,CAAA;AAElC,QAAA,aAAa,GAItB;IACF,GAAG,EAAE,eAAe;IACpB,UAAU;IACV,OAAO,EAAE,KAAK,EAAE,EACd,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAChD,SAAS,EACT,OAAO,GACR,EAAE,EAAE;;QACH,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAA;QAC/B,MAAM,cAAc,GAClB,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,QAAQ,0CAAE,gBAAgB,CAAA;QAEhD,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,EAAE,CAAC;YAClB,MAAM,OAAO,CAAC;gBACZ,QAAQ,EAAE;oBACR,UAAU,EAAE,GAAG;oBACf,OAAO,EAAE,4BAA4B;iBACtC;aACF,CAAC,CAAA;QACJ,CAAC;QAED,MAAM,SAAS,CAAC;YACd,WAAW,EAAE;gBACX,MAAM;gBACN,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aACpC;YACD,GAAG,CAAC,cAAc,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;SACtD,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"callCompleted.js","sourceRoot":"","sources":["../../../../../extensions/bland/webhooks/CallCompleted/callCompleted.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAQ9B,MAAM,UAAU,GAAG;IACjB,MAAM,EAAE;QACN,GAAG,EAAE,QAAQ;QACb,SAAS,EAAE,QAAQ;KACpB;IACD,UAAU,EAAE;QACV,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,MAAM;KAClB;CAC4C,CAAA;AAElC,QAAA,aAAa,GAItB;IACF,GAAG,EAAE,eAAe;IACpB,UAAU;IACV,OAAO,EAAE,KAAK,EAAE,EACd,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAChD,SAAS,EACT,OAAO,GACR,EAAE,EAAE;;QACH,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAA;QAC/B,MAAM,cAAc,GAClB,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,QAAQ,0CAAE,gBAAgB,CAAA;QAEhD,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,EAAE,CAAC;YAClB,MAAM,OAAO,CAAC;gBACZ,QAAQ,EAAE;oBACR,UAAU,EAAE,GAAG;oBACf,OAAO,EAAE,4BAA4B;iBACtC;aACF,CAAC,CAAA;QACJ,CAAC;QAED,MAAM,SAAS,CAAC;YACd,WAAW,EAAE;gBACX,MAAM;gBACN,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aACpC;YACD,GAAG,CAAC,cAAc,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;SACpE,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
@@ -1 +1,2 @@
1
1
  export * from './log';
2
+ export * from './log_two';
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./log"), exports);
18
+ __exportStar(require("./log_two"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/hello-world/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/hello-world/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,4CAAyB"}
@@ -0,0 +1,18 @@
1
+ import { FieldType, type Action } from '@awell-health/extensions-core';
2
+ import { type settings } from '../settings';
3
+ declare const fields: {
4
+ hello: {
5
+ id: string;
6
+ label: string;
7
+ description: string;
8
+ type: FieldType.STRING;
9
+ };
10
+ };
11
+ declare const dataPoints: {
12
+ world: {
13
+ key: string;
14
+ valueType: "string";
15
+ };
16
+ };
17
+ export declare const logTwo: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
18
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logTwo = void 0;
4
+ const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const extensions_core_2 = require("@awell-health/extensions-core");
6
+ const fields = {
7
+ hello: {
8
+ id: 'hello',
9
+ label: 'Hello',
10
+ description: 'A string field configured at design time',
11
+ type: extensions_core_1.FieldType.STRING,
12
+ },
13
+ };
14
+ const dataPoints = {
15
+ world: {
16
+ key: 'world',
17
+ valueType: 'string',
18
+ },
19
+ };
20
+ exports.logTwo = {
21
+ key: 'log-two',
22
+ category: extensions_core_2.Category.DEMO,
23
+ title: 'Log a second time',
24
+ description: 'This is a dummy Custom Action for extension developers.',
25
+ fields,
26
+ previewable: true,
27
+ dataPoints,
28
+ onActivityCreated: async (payload, onComplete) => {
29
+ const { fields } = payload;
30
+ await onComplete({
31
+ data_points: {
32
+ world: fields.hello,
33
+ },
34
+ });
35
+ },
36
+ };
37
+ //# sourceMappingURL=log_two.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log_two.js","sourceRoot":"","sources":["../../../../extensions/hello-world/actions/log_two.ts"],"names":[],"mappings":";;;AAAA,mEAKsC;AACtC,mEAAwD;AAGxD,MAAM,MAAM,GAAG;IACb,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,0CAA0C;QACvD,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;CAC8B,CAAA;AAEjC,MAAM,UAAU,GAAG;IACjB,KAAK,EAAE;QACL,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,MAAM,GAIf;IACF,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,0BAAQ,CAAC,IAAI;IACvB,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,yDAAyD;IACtE,MAAM;IACN,WAAW,EAAE,IAAI;IACjB,UAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAiB,EAAE;QAC9D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;QAC1B,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
@@ -17,6 +17,7 @@ exports.HelloWorld = {
17
17
  settings: settings_1.settings,
18
18
  actions: {
19
19
  log: actions_1.log,
20
+ logTwo: actions_1.logTwo,
20
21
  },
21
22
  webhooks: webhooks_1.webhooks,
22
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../extensions/hello-world/index.ts"],"names":[],"mappings":";;;AAAA,uCAA+B;AAE/B,yCAAqC;AACrC,yCAAqC;AACrC,mEAAoE;AAEvD,QAAA,UAAU,GAAc;IACnC,GAAG,EAAE,aAAa;IAClB,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,iGAAiG;IACnG,QAAQ,EACN,iGAAiG;IACnG,QAAQ,EAAE,0BAAQ,CAAC,IAAI;IACvB,MAAM,EAAE;QACN,UAAU,EAAE,4BAAU,CAAC,KAAK;KAC7B;IACD,QAAQ,EAAR,mBAAQ;IACR,OAAO,EAAE;QACP,GAAG,EAAH,aAAG;KACJ;IACD,QAAQ,EAAR,mBAAQ;CACT,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../extensions/hello-world/index.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AAEvC,yCAAqC;AACrC,yCAAqC;AACrC,mEAAoE;AAEvD,QAAA,UAAU,GAAc;IACnC,GAAG,EAAE,aAAa;IAClB,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,iGAAiG;IACnG,QAAQ,EACN,iGAAiG;IACnG,QAAQ,EAAE,0BAAQ,CAAC,IAAI;IACvB,MAAM,EAAE;QACN,UAAU,EAAE,4BAAU,CAAC,KAAK;KAC7B;IACD,QAAQ,EAAR,mBAAQ;IACR,OAAO,EAAE;QACP,GAAG,EAAH,aAAG;QACH,MAAM,EAAN,gBAAM;KACP;IACD,QAAQ,EAAR,mBAAQ;CACT,CAAA"}
@@ -8,11 +8,21 @@ export declare const fields: {
8
8
  type: FieldType.STRING;
9
9
  required: true;
10
10
  };
11
+ countryCallingCode: {
12
+ id: string;
13
+ label: string;
14
+ description: string;
15
+ type: FieldType.NUMERIC;
16
+ required: false;
17
+ };
11
18
  };
12
19
  export declare const FieldsValidationSchema: z.ZodObject<{
13
20
  text: z.ZodString;
21
+ countryCallingCode: z.ZodOptional<z.ZodNumber>;
14
22
  }, "strip", z.ZodTypeAny, {
15
23
  text: string;
24
+ countryCallingCode?: number | undefined;
16
25
  }, {
17
26
  text: string;
27
+ countryCallingCode?: number | undefined;
18
28
  }>;
@@ -11,8 +11,16 @@ exports.fields = {
11
11
  type: extensions_core_1.FieldType.STRING,
12
12
  required: true,
13
13
  },
14
+ countryCallingCode: {
15
+ id: 'countryCallingCode',
16
+ label: 'Country calling code',
17
+ description: 'The country calling code you want to use for the phone number in case the phone number is not in E164 format. Enter the country calling code as a number.',
18
+ type: extensions_core_1.FieldType.NUMERIC,
19
+ required: false,
20
+ },
14
21
  };
15
22
  exports.FieldsValidationSchema = zod_1.z.object({
16
23
  text: zod_1.z.string(),
24
+ countryCallingCode: zod_1.z.number().optional(),
17
25
  });
18
26
  //# sourceMappingURL=fields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../../extensions/transform/v1/actions/parseStringToPhoneNumber/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAAqE;AAExD,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,8CAA8C;QAC3D,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;CACiC,CAAC,CAAA"}
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../../extensions/transform/v1/actions/parseStringToPhoneNumber/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAAqE;AAExD,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,8CAA8C;QAC3D,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,oBAAoB;QACxB,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,2JAA2J;QAC7J,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,kBAAkB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACQ,CAAC,CAAA"}
@@ -2,27 +2,61 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseStringToPhoneNumber = void 0;
4
4
  const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const extensions_core_2 = require("@awell-health/extensions-core");
5
6
  const config_1 = require("./config");
6
7
  const zod_1 = require("zod");
8
+ const lodash_1 = require("lodash");
9
+ const addEventLog_1 = require("../../../../../src/lib/awell/addEventLog");
7
10
  exports.parseStringToPhoneNumber = {
8
11
  key: 'parseStringToPhoneNumber',
9
12
  title: 'Parse text to phone number',
10
13
  description: 'Transform or parse text to a phone number.',
11
- category: extensions_core_1.Category.DATA,
14
+ category: extensions_core_2.Category.DATA,
12
15
  fields: config_1.fields,
13
16
  dataPoints: config_1.dataPoints,
14
17
  previewable: true,
15
- onActivityCreated: async (payload, onComplete) => {
16
- const { fields: { text }, } = (0, extensions_core_1.validate)({
18
+ onEvent: async ({ payload, onComplete }) => {
19
+ const { fields: { text, countryCallingCode }, } = (0, extensions_core_2.validate)({
17
20
  schema: zod_1.z.object({
18
21
  fields: config_1.FieldsValidationSchema,
19
22
  }),
20
23
  payload,
21
24
  });
25
+ const events = [];
26
+ const getPhoneNumber = () => {
27
+ const parsed = extensions_core_1.E164PhoneValidationSchema.safeParse(text);
28
+ /**
29
+ * If E164 validation passes, the phone number is already in E164 format.
30
+ */
31
+ if (parsed.success) {
32
+ events.push((0, addEventLog_1.addActivityEventLog)({
33
+ message: `Text input is a valid E164 phone number.`,
34
+ }));
35
+ return parsed.data;
36
+ }
37
+ /**
38
+ * If the country calling code is not provided, we can throw a validation error.
39
+ */
40
+ if ((0, lodash_1.isNil)(countryCallingCode)) {
41
+ events.push((0, addEventLog_1.addActivityEventLog)({
42
+ message: `Text input is not a valid E164 phone number and no country calling code was provided.`,
43
+ }));
44
+ throw new zod_1.ZodError(parsed.error.issues);
45
+ }
46
+ events.push((0, addEventLog_1.addActivityEventLog)({
47
+ message: `Text input is not a valid E164 phone number. Trying again by adding country calling code (${countryCallingCode}).`,
48
+ }));
49
+ /**
50
+ * Try parsing the number with the country calling code prepended this time.
51
+ */
52
+ const withCode = `+${countryCallingCode}${text}`;
53
+ return extensions_core_1.E164PhoneValidationSchema.parse(withCode);
54
+ };
22
55
  await onComplete({
23
56
  data_points: {
24
- phoneNumber: String(text),
57
+ phoneNumber: getPhoneNumber(),
25
58
  },
59
+ events,
26
60
  });
27
61
  },
28
62
  };
@@ -1 +1 @@
1
- {"version":3,"file":"parseStringToPhoneNumber.js","sourceRoot":"","sources":["../../../../../../extensions/transform/v1/actions/parseStringToPhoneNumber/parseStringToPhoneNumber.ts"],"names":[],"mappings":";;;AACA,mEAAkE;AAElE,qCAAqE;AACrE,6BAAuB;AAEV,QAAA,wBAAwB,GAIjC;IACF,GAAG,EAAE,0BAA0B;IAC/B,KAAK,EAAE,4BAA4B;IACnC,WAAW,EAAE,4CAA4C;IACzD,QAAQ,EAAE,0BAAQ,CAAC,IAAI;IACvB,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE;QAC/C,MAAM,EACJ,MAAM,EAAE,EAAE,IAAI,EAAE,GACjB,GAAG,IAAA,0BAAQ,EAAC;YACX,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;gBACf,MAAM,EAAE,+BAAsB;aAC/B,CAAC;YACF,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC;aAC1B;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"parseStringToPhoneNumber.js","sourceRoot":"","sources":["../../../../../../extensions/transform/v1/actions/parseStringToPhoneNumber/parseStringToPhoneNumber.ts"],"names":[],"mappings":";;;AAAA,mEAIsC;AACtC,mEAAkE;AAElE,qCAAqE;AACrE,6BAAiC;AACjC,mCAA8B;AAC9B,0EAA8E;AAEjE,QAAA,wBAAwB,GAIjC;IACF,GAAG,EAAE,0BAA0B;IAC/B,KAAK,EAAE,4BAA4B;IACnC,WAAW,EAAE,4CAA4C;IACzD,QAAQ,EAAE,0BAAQ,CAAC,IAAI;IACvB,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE;QACzC,MAAM,EACJ,MAAM,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,GACrC,GAAG,IAAA,0BAAQ,EAAC;YACX,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;gBACf,MAAM,EAAE,+BAAsB;aAC/B,CAAC;YACF,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,MAAM,GAAoB,EAAE,CAAA;QAElC,MAAM,cAAc,GAAG,GAAW,EAAE;YAClC,MAAM,MAAM,GAAG,2CAAyB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAExD;;eAEG;YACH,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,MAAM,CAAC,IAAI,CACT,IAAA,iCAAmB,EAAC;oBAClB,OAAO,EAAE,0CAA0C;iBACpD,CAAC,CACH,CAAA;gBACD,OAAO,MAAM,CAAC,IAAI,CAAA;YACpB,CAAC;YAED;;eAEG;YACH,IAAI,IAAA,cAAK,EAAC,kBAAkB,CAAC,EAAE,CAAC;gBAC9B,MAAM,CAAC,IAAI,CACT,IAAA,iCAAmB,EAAC;oBAClB,OAAO,EAAE,uFAAuF;iBACjG,CAAC,CACH,CAAA;gBACD,MAAM,IAAI,cAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YACzC,CAAC;YAED,MAAM,CAAC,IAAI,CACT,IAAA,iCAAmB,EAAC;gBAClB,OAAO,EAAE,6FAA6F,kBAAkB,IAAI;aAC7H,CAAC,CACH,CAAA;YAED;;eAEG;YACH,MAAM,QAAQ,GAAG,IAAI,kBAAkB,GAAG,IAAI,EAAE,CAAA;YAChD,OAAO,2CAAyB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAClD,CAAC,CAAA;QAED,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,WAAW,EAAE,cAAc,EAAE;aAC9B;YACD,MAAM;SACP,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.0.278",
3
+ "version": "2.0.280",
4
4
  "packageManager": "yarn@4.5.3",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {