@awell-health/awell-extensions 2.0.34 → 2.0.36
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/sfdc/actions/createLead/config/fields.d.ts +10 -0
- package/dist/extensions/sfdc/actions/createLead/config/fields.js +8 -0
- package/dist/extensions/sfdc/actions/createLead/config/fields.js.map +1 -1
- package/dist/extensions/sfdc/actions/createLead/createLead.js +9 -1
- package/dist/extensions/sfdc/actions/createLead/createLead.js.map +1 -1
- package/dist/extensions/sfdc/actions/createLead/createLead.test.js.map +1 -1
- package/dist/extensions/sfdc/actions/index.d.ts +7 -0
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.d.ts +1 -1
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.js +11 -12
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.js.map +1 -1
- package/package.json +1 -1
@@ -8,11 +8,21 @@ export declare const fields: {
|
|
8
8
|
type: FieldType.JSON;
|
9
9
|
required: true;
|
10
10
|
};
|
11
|
+
careFlowIdField: {
|
12
|
+
id: string;
|
13
|
+
label: string;
|
14
|
+
description: string;
|
15
|
+
type: FieldType.STRING;
|
16
|
+
required: false;
|
17
|
+
};
|
11
18
|
};
|
12
19
|
export declare const FieldsValidationSchema: z.ZodObject<{
|
13
20
|
data: z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, any, string>, any, string>, any, string>, any, string>, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
21
|
+
careFlowIdField: z.ZodOptional<z.ZodString>;
|
14
22
|
}, "strip", z.ZodTypeAny, {
|
15
23
|
data: Record<string, unknown>;
|
24
|
+
careFlowIdField?: string | undefined;
|
16
25
|
}, {
|
17
26
|
data: string;
|
27
|
+
careFlowIdField?: string | undefined;
|
18
28
|
}>;
|
@@ -14,6 +14,13 @@ exports.fields = {
|
|
14
14
|
type: extensions_core_1.FieldType.JSON,
|
15
15
|
required: true,
|
16
16
|
},
|
17
|
+
careFlowIdField: {
|
18
|
+
id: 'careFlowIdField',
|
19
|
+
label: 'Care Flow ID Field',
|
20
|
+
description: 'The field name in Salesforce that contains the Care Flow ID. If left blank, the Care Flow ID will not be included in the update.',
|
21
|
+
type: extensions_core_1.FieldType.STRING,
|
22
|
+
required: false,
|
23
|
+
},
|
17
24
|
};
|
18
25
|
exports.FieldsValidationSchema = zod_1.default.object({
|
19
26
|
data: zod_1.default
|
@@ -40,5 +47,6 @@ exports.FieldsValidationSchema = zod_1.default.object({
|
|
40
47
|
message: 'All values must be defined',
|
41
48
|
})
|
42
49
|
.pipe(zod_1.default.record(zod_1.default.unknown())),
|
50
|
+
careFlowIdField: zod_1.default.string().optional(),
|
43
51
|
});
|
44
52
|
//# sourceMappingURL=fields.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/sfdc/actions/createLead/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,8CAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,qCAAqC;QAClD,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,aAAC;SACJ,MAAM,EAAE;SACR,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE;QACjB,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;SACvB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;SACvC;IACH,CAAC,CAAC;SACD,MAAM,CACL,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EACvE;QACE,OAAO,EAAE,+BAA+B;KACzC,CACF;SACA,MAAM,CACL,CAAC,GAAG,EAAE,EAAE;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAA;IACjE,CAAC,EACD;QACE,OAAO,EAAE,0BAA0B;KACpC,CACF;SACA,MAAM,CACL,CAAC,GAAG,EAAE,EAAE;QACN,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,WAAW,CAAC,CAAA;IAC1E,CAAC,EACD;QACE,OAAO,EAAE,4BAA4B;KACtC,CACF;SACA,IAAI,CAAC,aAAC,CAAC,MAAM,CAAC,aAAC,CAAC,OAAO,EAAE,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/sfdc/actions/createLead/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,8CAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,qCAAqC;QAClD,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;KACf;IACD,eAAe,EAAE;QACf,EAAE,EAAE,iBAAiB;QACrB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,kIAAkI;QACpI,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,aAAC;SACJ,MAAM,EAAE;SACR,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE;QACjB,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;SACvB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;SACvC;IACH,CAAC,CAAC;SACD,MAAM,CACL,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EACvE;QACE,OAAO,EAAE,+BAA+B;KACzC,CACF;SACA,MAAM,CACL,CAAC,GAAG,EAAE,EAAE;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAA;IACjE,CAAC,EACD;QACE,OAAO,EAAE,0BAA0B;KACpC,CACF;SACA,MAAM,CACL,CAAC,GAAG,EAAE,EAAE;QACN,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,WAAW,CAAC,CAAA;IAC1E,CAAC,EACD;QACE,OAAO,EAAE,4BAA4B;KACtC,CACF;SACA,IAAI,CAAC,aAAC,CAAC,MAAM,CAAC,aAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9B,eAAe,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACW,CAAC,CAAA"}
|
@@ -5,6 +5,7 @@ const extensions_core_1 = require("@awell-health/extensions-core");
|
|
5
5
|
const config_1 = require("./config");
|
6
6
|
const lib_1 = require("../../lib");
|
7
7
|
const errors_1 = require("../../lib/errors");
|
8
|
+
const lodash_1 = require("lodash");
|
8
9
|
exports.createLead = {
|
9
10
|
key: 'createLead',
|
10
11
|
category: extensions_core_1.Category.CUSTOMER_SUPPORT,
|
@@ -14,14 +15,21 @@ exports.createLead = {
|
|
14
15
|
previewable: false,
|
15
16
|
dataPoints: config_1.dataPoints,
|
16
17
|
onActivityCreated: async (payload, onComplete, onError) => {
|
18
|
+
const careFlowId = payload.pathway.id;
|
17
19
|
const { fields, salesforceClient } = await (0, lib_1.validatePayloadAndCreateClient)({
|
18
20
|
fieldsSchema: config_1.FieldsValidationSchema,
|
19
21
|
payload,
|
20
22
|
});
|
23
|
+
const data = {
|
24
|
+
...fields.data,
|
25
|
+
...(!(0, lodash_1.isNil)(fields.careFlowIdField) && {
|
26
|
+
[fields.careFlowIdField]: careFlowId,
|
27
|
+
}),
|
28
|
+
};
|
21
29
|
try {
|
22
30
|
const res = await salesforceClient.createRecord({
|
23
31
|
sObject: 'Lead',
|
24
|
-
data
|
32
|
+
data,
|
25
33
|
});
|
26
34
|
await onComplete({
|
27
35
|
data_points: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createLead.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/createLead/createLead.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,mCAA0D;AAC1D,6CAA0E;
|
1
|
+
{"version":3,"file":"createLead.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/createLead/createLead.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,mCAA0D;AAC1D,6CAA0E;AAC1E,mCAA8B;AAEjB,QAAA,UAAU,GAInB;IACF,GAAG,EAAE,YAAY;IACjB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,yCAAyC;IACtD,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,EAAE;QACvE,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,CAAA;QACrC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,oCAA8B,EAAC;YACxE,YAAY,EAAE,+BAAsB;YACpC,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,IAAI,GAAG;YACX,GAAG,MAAM,CAAC,IAAI;YACd,GAAG,CAAC,CAAC,IAAA,cAAK,EAAC,MAAM,CAAC,eAAe,CAAC,IAAI;gBACpC,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,UAAU;aACrC,CAAC;SACH,CAAA;QAED,IAAI;YACF,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC;gBAC9C,OAAO,EAAE,MAAM;gBACf,IAAI;aACL,CAAC,CAAA;YAEF,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;iBAC9B;aACF,CAAC,CAAA;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,IAAA,0BAAiB,EAAC,KAAK,CAAC,EAAE;gBAC5B,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,CAAC,IAAA,6BAAoB,EAAC,KAAK,CAAC,CAAC;iBACtC,CAAC,CAAA;aACH;iBAAM;gBACL,qEAAqE;gBACrE,MAAM,KAAK,CAAA;aACZ;SACF;IACH,CAAC;CACF,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createLead.test.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/createLead/createLead.test.ts"],"names":[],"mappings":";;AAAA,wBAA8B;AAC9B,iDAA2D;AAC3D,kDAA4E;AAE5E,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;AAE7B,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEzB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACtC,MAAM,0BAA0B,GAAG,IAAA,2BAAmB,EAAC;YACrD,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,YAAY,EAAE,oBAAoB;oBAClC,UAAU,EAAE,SAAS;oBACrB,gBAAgB,EAAE,eAAe;oBACjC,QAAQ,EAAE,KAAK;oBACf,KAAK,EAAE,qBAAqB;oBAC5B,KAAK,EAAE,cAAc;oBACrB,MAAM,EAAE,KAAK;iBACd,CAAC;
|
1
|
+
{"version":3,"file":"createLead.test.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/createLead/createLead.test.ts"],"names":[],"mappings":";;AAAA,wBAA8B;AAC9B,iDAA2D;AAC3D,kDAA4E;AAE5E,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;AAE7B,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEzB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACtC,MAAM,0BAA0B,GAAG,IAAA,2BAAmB,EAAC;YACrD,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,YAAY,EAAE,oBAAoB;oBAClC,UAAU,EAAE,SAAS;oBACrB,gBAAgB,EAAE,eAAe;oBACjC,QAAQ,EAAE,KAAK;oBACf,KAAK,EAAE,qBAAqB;oBAC5B,KAAK,EAAE,cAAc;oBACrB,MAAM,EAAE,KAAK;iBACd,CAAC;aACI;YACR,QAAQ,EAAE,uBAAY;SACvB,CAAC,CAAA;QAEF,MAAM,aAAU,CAAC,iBAAkB,CACjC,0BAA0B,EAC1B,UAAU,EACV,OAAO,CACR,CAAA;QAED,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,WAAW,EAAE;gBACX,aAAa,EAAE,MAAM,CAAC,mCAAwB,CAAC,EAAE,CAAC;aACnD;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -7,6 +7,13 @@ declare const actions: {
|
|
7
7
|
type: import("@awell-health/extensions-core").FieldType.JSON;
|
8
8
|
required: true;
|
9
9
|
};
|
10
|
+
careFlowIdField: {
|
11
|
+
id: string;
|
12
|
+
label: string;
|
13
|
+
description: string;
|
14
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
15
|
+
required: false;
|
16
|
+
};
|
10
17
|
}, {
|
11
18
|
salesforceSubdomain: {
|
12
19
|
key: string;
|
package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.d.ts
CHANGED
@@ -21,4 +21,4 @@ export declare const parser: StructuredOutputParser<z.ZodObject<{
|
|
21
21
|
match_explanation: string;
|
22
22
|
matched_category?: string | undefined;
|
23
23
|
}>>;
|
24
|
-
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an expert in categorizing
|
24
|
+
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an expert in categorizing different patient messages in a clinical context.\n Use your expertise to solve the message categorization task:\n 1. Categorize the input message into **one of the provided categories**: {categories}. If no category fits, return \"None\".\n 2. Provide a concise explanation of why the message belongs to the selected category.\n \n Important Instructions:\n - The message may be in multiple languages.\n - **Only** choose from the provided list of categories. **Do not create new categories** or alter the given ones.\n - If no category fits perfectly, or if the match is unclear, return \"None\" without guessing.\n - Carefully verify your selection before submitting your answer.\n \n Respond exclusively with a valid JSON object containing the following keys:\n - matched_category: The most suitable category. Must be from the following list: {categories} - None if no category fits. Absolutely refrain from creating new categories or altering existent one. Output should be one of the provided categories in the list.\n - match_explanation: A brief explanation supporting your decision.\n \n Input:\n {input}\n ">, any>;
|
package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.js
CHANGED
@@ -11,22 +11,21 @@ exports.messageCategoriesSchema = zod_1.z.object({
|
|
11
11
|
});
|
12
12
|
// Create a structured output parser
|
13
13
|
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(exports.messageCategoriesSchema);
|
14
|
-
// TODO: move prompt to LangSmith + further tune
|
15
14
|
exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
|
16
|
-
You are an expert in categorizing
|
17
|
-
Use your expertise to solve the
|
18
|
-
1.
|
19
|
-
2. Provide a
|
15
|
+
You are an expert in categorizing different patient messages in a clinical context.
|
16
|
+
Use your expertise to solve the message categorization task:
|
17
|
+
1. Categorize the input message into **one of the provided categories**: {categories}. If no category fits, return "None".
|
18
|
+
2. Provide a concise explanation of why the message belongs to the selected category.
|
20
19
|
|
21
|
-
Instructions
|
22
|
-
- The message may be in
|
23
|
-
-
|
24
|
-
- If no
|
25
|
-
|
20
|
+
Important Instructions:
|
21
|
+
- The message may be in multiple languages.
|
22
|
+
- **Only** choose from the provided list of categories. **Do not create new categories** or alter the given ones.
|
23
|
+
- If no category fits perfectly, or if the match is unclear, return "None" without guessing.
|
24
|
+
- Carefully verify your selection before submitting your answer.
|
26
25
|
|
27
26
|
Respond exclusively with a valid JSON object containing the following keys:
|
28
|
-
- matched_category: The
|
29
|
-
- match_explanation: A
|
27
|
+
- matched_category: The most suitable category. Must be from the following list: {categories} - None if no category fits. Absolutely refrain from creating new categories or altering existent one. Output should be one of the provided categories in the list.
|
28
|
+
- match_explanation: A brief explanation supporting your decision.
|
30
29
|
|
31
30
|
Input:
|
32
31
|
{input}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAC5D,6DAAiE;AACjE,6BAAuB;AAEvB,oDAAoD;AACvC,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IACvD,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,wCAAwC;CACxE,CAAC,CAAA;AAEF,oCAAoC;AACvB,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,+BAAuB,CACxB,CAAA;
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAC5D,6DAAiE;AACjE,6BAAuB;AAEvB,oDAAoD;AACvC,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IACvD,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,wCAAwC;CACxE,CAAC,CAAA;AAEF,oCAAoC;AACvB,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,+BAAuB,CACxB,CAAA;AAEY,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;OAkBrD,CAAC,CAAA"}
|