@awell-health/awell-extensions 2.1.201 → 2.1.202
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.
- package/dist/extensions/awell/index.js +1 -0
- package/dist/extensions/awell/index.js.map +1 -1
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/config/dataPoints.d.ts +6 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/config/dataPoints.js +10 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/config/dataPoints.js.map +1 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/config/fields.d.ts +22 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/config/fields.js +29 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/config/fields.js.map +1 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/config/index.d.ts +2 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/config/index.js +9 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/config/index.js.map +1 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/getHostedPagesLink.d.ts +4 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/getHostedPagesLink.js +96 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/getHostedPagesLink.js.map +1 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/index.d.ts +1 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/index.js +6 -0
- package/dist/extensions/awell/v1/actions/getHostedPagesLink/index.js.map +1 -0
- package/dist/extensions/awell/v1/actions/index.d.ts +1 -0
- package/dist/extensions/awell/v1/actions/index.js +3 -1
- package/dist/extensions/awell/v1/actions/index.js.map +1 -1
- package/dist/extensions/awell/v1/actions/startHostedPagesSession/startHostedPagesSession.js +11 -26
- package/dist/extensions/awell/v1/actions/startHostedPagesSession/startHostedPagesSession.js.map +1 -1
- package/dist/extensions/markdown.json +2 -2
- package/dist/src/lib/awell/getStakeholderId/getStakeholderId.d.ts +18 -0
- package/dist/src/lib/awell/getStakeholderId/getStakeholderId.js +41 -0
- package/dist/src/lib/awell/getStakeholderId/getStakeholderId.js.map +1 -0
- package/dist/src/lib/awell/getStakeholderId/index.d.ts +1 -0
- package/dist/src/lib/awell/getStakeholderId/index.js +18 -0
- package/dist/src/lib/awell/getStakeholderId/index.js.map +1 -0
- package/dist/src/lib/awell/index.d.ts +1 -0
- package/dist/src/lib/awell/index.js +1 -0
- package/dist/src/lib/awell/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ exports.Awell = {
|
|
|
29
29
|
isPatientEnrolledInTrack: actions_1.isPatientEnrolledInTrack,
|
|
30
30
|
updateBaselineInfo: actions_1.updateBaselineInfo,
|
|
31
31
|
startHostedPagesSession: actions_1.startHostedPagesSession,
|
|
32
|
+
getHostedPagesLink: actions_1.getHostedPagesLink,
|
|
32
33
|
startCareFlowAndSession: actions_1.startCareFlowAndSession,
|
|
33
34
|
getDataPointValue: actions_1.getDataPointValue,
|
|
34
35
|
listFormAnswers: actions_1.listFormAnswers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../extensions/awell/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../extensions/awell/index.ts"],"names":[],"mappings":";;;AAAA,0CAmBqB;AAErB,yCAAqC;AACrC,4CAAwC;AACxC,8CAA0C;AAC1C,mEAAoE;AAEvD,QAAA,KAAK,GAAc;IAC9B,GAAG,EAAE,OAAO;IACZ,KAAK,EAAE,gBAAgB;IACvB,QAAQ,EACN,iGAAiG;IACnG,WAAW,EAAE,qDAAqD;IAClE,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,MAAM,EAAE;QACN,UAAU,EAAE,4BAAU,CAAC,KAAK;KAC7B;IACD,QAAQ,EAAR,mBAAQ;IACR,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;QACb,sBAAsB,EAAtB,gCAAsB;QACtB,sBAAsB,EAAtB,gCAAsB;QACtB,aAAa,EAAb,uBAAa;QACb,aAAa,EAAb,uBAAa;QACb,YAAY,EAAZ,sBAAY;QACZ,SAAS,EAAT,mBAAS;QACT,2BAA2B,EAA3B,qCAA2B;QAC3B,2BAA2B,EAA3B,qCAA2B;QAC3B,wBAAwB,EAAxB,kCAAwB;QACxB,kBAAkB,EAAlB,4BAAkB;QAClB,uBAAuB,EAAvB,iCAAuB;QACvB,kBAAkB,EAAlB,4BAAkB;QAClB,uBAAuB,EAAvB,iCAAuB;QACvB,iBAAiB,EAAjB,2BAAiB;QACjB,eAAe,EAAf,yBAAe;QACf,iBAAiB,EAAjB,2BAAiB;QACjB,oBAAoB,EAApB,8BAAoB;KACrB;IACD,QAAQ,EAAR,mBAAQ;IACR,UAAU,EAAE,EAAE,MAAM,EAAE,yBAAyB,EAAE;IACjD,SAAS,EAAT,qBAAS;CACV,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../../extensions/awell/v1/actions/getHostedPagesLink/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,OAAO,EAAE;QACP,GAAG,EAAE,SAAS;QACd,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FieldType } from '@awell-health/extensions-core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const fields: {
|
|
4
|
+
careFlowId: {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
description: string;
|
|
8
|
+
type: FieldType.STRING;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
stakeholder: {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
description: string;
|
|
15
|
+
type: FieldType.STRING;
|
|
16
|
+
required: false;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const FieldsValidationSchema: z.ZodObject<{
|
|
20
|
+
careFlowId: z.ZodString;
|
|
21
|
+
stakeholder: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string | undefined>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldsValidationSchema = exports.fields = 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
|
+
exports.fields = {
|
|
8
|
+
careFlowId: {
|
|
9
|
+
id: 'careFlowId',
|
|
10
|
+
label: 'Care flow ID',
|
|
11
|
+
description: 'The instance ID of the care flow to fetch the link for',
|
|
12
|
+
type: extensions_core_1.FieldType.STRING,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
stakeholder: {
|
|
16
|
+
id: 'stakeholder',
|
|
17
|
+
label: 'Stakeholder',
|
|
18
|
+
description: 'The name of the stakeholder to fetch the static Hosted Pages link for. Defaults to "patient" when left empty.',
|
|
19
|
+
type: extensions_core_1.FieldType.STRING,
|
|
20
|
+
required: false,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
exports.FieldsValidationSchema = zod_1.z.object({
|
|
24
|
+
careFlowId: zod_1.z.string().min(1),
|
|
25
|
+
stakeholder: zod_1.z
|
|
26
|
+
.optional(zod_1.z.string())
|
|
27
|
+
.transform((value) => ((0, lodash_1.isNil)(value) || (0, lodash_1.isEmpty)(value) ? 'patient' : value)),
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../../extensions/awell/v1/actions/getHostedPagesLink/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,mCAAuC;AACvC,6BAAqC;AAExB,QAAA,MAAM,GAAG;IACpB,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,wDAAwD;QACrE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,+GAA+G;QACjH,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,WAAW,EAAE,OAAC;SACX,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;SACpB,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAA,cAAK,EAAC,KAAK,CAAC,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;CAC/B,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dataPoints = exports.FieldsValidationSchema = exports.fields = void 0;
|
|
4
|
+
var fields_1 = require("./fields");
|
|
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; } });
|
|
7
|
+
var dataPoints_1 = require("./dataPoints");
|
|
8
|
+
Object.defineProperty(exports, "dataPoints", { enumerable: true, get: function () { return dataPoints_1.dataPoints; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../extensions/awell/v1/actions/getHostedPagesLink/config/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AACvC,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHostedPagesLink = void 0;
|
|
4
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
|
5
|
+
const config_1 = require("./config");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const addEventLog_1 = require("../../../../../src/lib/awell/addEventLog");
|
|
8
|
+
const getStakeholderId_1 = require("../../../../../src/lib/awell/getStakeholderId");
|
|
9
|
+
exports.getHostedPagesLink = {
|
|
10
|
+
key: 'getHostedPagesLink',
|
|
11
|
+
category: extensions_core_1.Category.WORKFLOW,
|
|
12
|
+
title: 'Get Hosted Pages Link',
|
|
13
|
+
description: 'Fetch the static Hosted Pages link for a stakeholder (defaults to the patient)',
|
|
14
|
+
fields: config_1.fields,
|
|
15
|
+
dataPoints: config_1.dataPoints,
|
|
16
|
+
previewable: false,
|
|
17
|
+
supports_automated_retries: true,
|
|
18
|
+
onEvent: async ({ payload, onComplete, onError, helpers }) => {
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
helpers.log({ fields: payload.fields }, 'Processing getHostedPagesLink');
|
|
21
|
+
try {
|
|
22
|
+
const { fields: { careFlowId, stakeholder }, } = (0, extensions_core_1.validate)({
|
|
23
|
+
schema: zod_1.z.object({
|
|
24
|
+
fields: config_1.FieldsValidationSchema,
|
|
25
|
+
}),
|
|
26
|
+
payload,
|
|
27
|
+
});
|
|
28
|
+
const sdk = await helpers.awellSdk();
|
|
29
|
+
const pathwayRes = await sdk.orchestration.query({
|
|
30
|
+
pathway: {
|
|
31
|
+
__args: {
|
|
32
|
+
id: careFlowId,
|
|
33
|
+
},
|
|
34
|
+
pathway: {
|
|
35
|
+
release_id: true,
|
|
36
|
+
patient_id: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const releaseId = (_a = pathwayRes === null || pathwayRes === void 0 ? void 0 : pathwayRes.pathway.pathway) === null || _a === void 0 ? void 0 : _a.release_id;
|
|
41
|
+
const patientId = (_b = pathwayRes === null || pathwayRes === void 0 ? void 0 : pathwayRes.pathway.pathway) === null || _b === void 0 ? void 0 : _b.patient_id;
|
|
42
|
+
if (releaseId === undefined)
|
|
43
|
+
throw new Error('Could not retrieve the release ID for this care flow.');
|
|
44
|
+
const stakeholderId = await (0, getStakeholderId_1.getStakeholderId)({
|
|
45
|
+
awellSdk: sdk,
|
|
46
|
+
pathwayId: careFlowId,
|
|
47
|
+
releaseId,
|
|
48
|
+
patientId,
|
|
49
|
+
stakeholder,
|
|
50
|
+
});
|
|
51
|
+
const res = await sdk.orchestration.query({
|
|
52
|
+
hostedPagesLink: {
|
|
53
|
+
__args: {
|
|
54
|
+
pathway_id: careFlowId,
|
|
55
|
+
stakeholder_id: stakeholderId,
|
|
56
|
+
},
|
|
57
|
+
success: true,
|
|
58
|
+
hosted_pages_link: {
|
|
59
|
+
id: true,
|
|
60
|
+
url: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
const linkUrl = (_c = res.hostedPagesLink.hosted_pages_link) === null || _c === void 0 ? void 0 : _c.url;
|
|
65
|
+
if (linkUrl === undefined || linkUrl === null)
|
|
66
|
+
throw new Error(`Could not find a Hosted Pages link for stakeholder ${stakeholder} in care flow ${careFlowId}. There may be no activity for this stakeholder in this care flow.`);
|
|
67
|
+
await onComplete({
|
|
68
|
+
data_points: {
|
|
69
|
+
linkUrl,
|
|
70
|
+
},
|
|
71
|
+
events: [
|
|
72
|
+
(0, addEventLog_1.addActivityEventLog)({
|
|
73
|
+
message: `Fetched the Hosted Pages link for care flow instance id ${careFlowId} and stakeholder ${stakeholder} (${stakeholderId}). Link URL is ${linkUrl}.`,
|
|
74
|
+
}),
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
helpers.log({ err }, 'error', err);
|
|
80
|
+
const error = err;
|
|
81
|
+
await onError({
|
|
82
|
+
events: [
|
|
83
|
+
{
|
|
84
|
+
date: new Date().toISOString(),
|
|
85
|
+
text: { en: error.message },
|
|
86
|
+
error: {
|
|
87
|
+
category: 'SERVER_ERROR',
|
|
88
|
+
message: error.message,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=getHostedPagesLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getHostedPagesLink.js","sourceRoot":"","sources":["../../../../../../extensions/awell/v1/actions/getHostedPagesLink/getHostedPagesLink.ts"],"names":[],"mappings":";;;AAEA,mEAAkE;AAClE,qCAAqE;AACrE,6BAAuB;AACvB,0EAA8E;AAC9E,oFAAgF;AAEnE,QAAA,kBAAkB,GAA2C;IACxE,GAAG,EAAE,oBAAoB;IACzB,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EACT,gFAAgF;IAClF,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,KAAK;IAClB,0BAA0B,EAAE,IAAI;IAChC,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;;QAC1E,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,+BAA+B,CAA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BACV;iBACF;aACF,CAAC,CAAA;YAEF,MAAM,OAAO,GAAG,MAAA,GAAG,CAAC,eAAe,CAAC,iBAAiB,0CAAE,GAAG,CAAA;YAE1D,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI;gBAC3C,MAAM,IAAI,KAAK,CACb,sDAAsD,WAAW,iBAAiB,UAAU,oEAAoE,CACjK,CAAA;YAEH,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,OAAO;iBACR;gBACD,MAAM,EAAE;oBACN,IAAA,iCAAmB,EAAC;wBAClB,OAAO,EAAE,2DAA2D,UAAU,oBAAoB,WAAW,KAAK,aAAa,kBAAkB,OAAO,GAAG;qBAC5J,CAAC;iBACH;aACF,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,GAAY,CAAC,CAAA;YAC3C,MAAM,KAAK,GAAG,GAAY,CAAA;YAC1B,MAAM,OAAO,CAAC;gBACZ,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE;wBAC3B,KAAK,EAAE;4BACL,QAAQ,EAAE,cAAc;4BACxB,OAAO,EAAE,KAAK,CAAC,OAAO;yBACvB;qBACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getHostedPagesLink } from './getHostedPagesLink';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHostedPagesLink = void 0;
|
|
4
|
+
var getHostedPagesLink_1 = require("./getHostedPagesLink");
|
|
5
|
+
Object.defineProperty(exports, "getHostedPagesLink", { enumerable: true, get: function () { return getHostedPagesLink_1.getHostedPagesLink; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/awell/v1/actions/getHostedPagesLink/index.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA"}
|
|
@@ -10,6 +10,7 @@ export { updateBaselineInfo } from './updateBaselineInfo';
|
|
|
10
10
|
export { getPatientByIdentifier } from './getPatientByIdentifier';
|
|
11
11
|
export { addIdentifierToPatient } from './addIdentifierToPatient';
|
|
12
12
|
export { startHostedPagesSession } from './startHostedPagesSession';
|
|
13
|
+
export { getHostedPagesLink } from './getHostedPagesLink';
|
|
13
14
|
export { startCareFlowAndSession } from './startCareFlowAndSession';
|
|
14
15
|
export { getDataPointValue } from './getDataPointValue';
|
|
15
16
|
export { listFormAnswers } from './listFormAnswers';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCurrentCareflowId = exports.createNaviSession = exports.listFormAnswers = exports.getDataPointValue = exports.startCareFlowAndSession = exports.startHostedPagesSession = exports.addIdentifierToPatient = exports.getPatientByIdentifier = exports.updateBaselineInfo = exports.isPatientEnrolledInTrack = exports.isPatientEnrolledInCareFlow = exports.searchPatientsByPatientCode = exports.stopTrack = exports.stopCareFlow = exports.updatePatient = exports.startCareFlow = exports.addAdhocTrack = void 0;
|
|
3
|
+
exports.getCurrentCareflowId = exports.createNaviSession = exports.listFormAnswers = exports.getDataPointValue = exports.startCareFlowAndSession = exports.getHostedPagesLink = exports.startHostedPagesSession = exports.addIdentifierToPatient = exports.getPatientByIdentifier = exports.updateBaselineInfo = exports.isPatientEnrolledInTrack = exports.isPatientEnrolledInCareFlow = exports.searchPatientsByPatientCode = exports.stopTrack = exports.stopCareFlow = exports.updatePatient = exports.startCareFlow = exports.addAdhocTrack = void 0;
|
|
4
4
|
var addAdhocTrack_1 = require("./addAdhocTrack");
|
|
5
5
|
Object.defineProperty(exports, "addAdhocTrack", { enumerable: true, get: function () { return addAdhocTrack_1.addAdhocTrack; } });
|
|
6
6
|
var startCareFlow_1 = require("./startCareFlow");
|
|
@@ -25,6 +25,8 @@ var addIdentifierToPatient_1 = require("./addIdentifierToPatient");
|
|
|
25
25
|
Object.defineProperty(exports, "addIdentifierToPatient", { enumerable: true, get: function () { return addIdentifierToPatient_1.addIdentifierToPatient; } });
|
|
26
26
|
var startHostedPagesSession_1 = require("./startHostedPagesSession");
|
|
27
27
|
Object.defineProperty(exports, "startHostedPagesSession", { enumerable: true, get: function () { return startHostedPagesSession_1.startHostedPagesSession; } });
|
|
28
|
+
var getHostedPagesLink_1 = require("./getHostedPagesLink");
|
|
29
|
+
Object.defineProperty(exports, "getHostedPagesLink", { enumerable: true, get: function () { return getHostedPagesLink_1.getHostedPagesLink; } });
|
|
28
30
|
var startCareFlowAndSession_1 = require("./startCareFlowAndSession");
|
|
29
31
|
Object.defineProperty(exports, "startCareFlowAndSession", { enumerable: true, get: function () { return startCareFlowAndSession_1.startCareFlowAndSession; } });
|
|
30
32
|
var getDataPointValue_1 = require("./getDataPointValue");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/awell/v1/actions/index.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AACrB,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAClB,6EAA2E;AAAlE,0IAAA,2BAA2B,OAAA;AACpC,6EAA2E;AAAlE,0IAAA,2BAA2B,OAAA;AACpC,uEAAqE;AAA5D,oIAAA,wBAAwB,OAAA;AACjC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A,oBAAoB,OAAA"}
|
|
@@ -5,6 +5,7 @@ const extensions_core_1 = require("@awell-health/extensions-core");
|
|
|
5
5
|
const config_1 = require("./config");
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
7
|
const addEventLog_1 = require("../../../../../src/lib/awell/addEventLog");
|
|
8
|
+
const getStakeholderId_1 = require("../../../../../src/lib/awell/getStakeholderId");
|
|
8
9
|
const delay = async (ms) => {
|
|
9
10
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
10
11
|
};
|
|
@@ -18,7 +19,7 @@ exports.startHostedPagesSession = {
|
|
|
18
19
|
previewable: false,
|
|
19
20
|
supports_automated_retries: true,
|
|
20
21
|
onEvent: async ({ payload, onComplete, onError, helpers }) => {
|
|
21
|
-
var _a;
|
|
22
|
+
var _a, _b;
|
|
22
23
|
helpers.log({ fields: payload.fields }, 'Processing startHostedPagesSession');
|
|
23
24
|
try {
|
|
24
25
|
const { fields: { careFlowId, stakeholder }, } = (0, extensions_core_1.validate)({
|
|
@@ -29,7 +30,6 @@ exports.startHostedPagesSession = {
|
|
|
29
30
|
});
|
|
30
31
|
// To make sure the care flow activated the activity for the stakeholder :-)
|
|
31
32
|
await delay(4000);
|
|
32
|
-
const normalizedStakeholder = stakeholder.toLowerCase();
|
|
33
33
|
const sdk = await helpers.awellSdk();
|
|
34
34
|
const pathwayRes = await sdk.orchestration.query({
|
|
35
35
|
pathway: {
|
|
@@ -38,36 +38,21 @@ exports.startHostedPagesSession = {
|
|
|
38
38
|
},
|
|
39
39
|
pathway: {
|
|
40
40
|
release_id: true,
|
|
41
|
+
patient_id: true,
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
});
|
|
44
45
|
const releaseId = (_a = pathwayRes === null || pathwayRes === void 0 ? void 0 : pathwayRes.pathway.pathway) === null || _a === void 0 ? void 0 : _a.release_id;
|
|
46
|
+
const patientId = (_b = pathwayRes === null || pathwayRes === void 0 ? void 0 : pathwayRes.pathway.pathway) === null || _b === void 0 ? void 0 : _b.patient_id;
|
|
45
47
|
if (releaseId === undefined)
|
|
46
48
|
throw new Error('Could not retrieve the release ID for this care flow.');
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
success: true,
|
|
55
|
-
stakeholders: {
|
|
56
|
-
id: true,
|
|
57
|
-
label: {
|
|
58
|
-
en: true,
|
|
59
|
-
},
|
|
60
|
-
definition_id: true,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
helpers.log({ careFlowId, stakeholdersInRelease }, 'stakeholdersInRelease');
|
|
65
|
-
const stakeholderMatchId = (_a = stakeholdersInRelease.stakeholdersByReleaseIds.stakeholders.find((stakeholder) => stakeholder.label.en.toLowerCase() === normalizedStakeholder)) === null || _a === void 0 ? void 0 : _a.id;
|
|
66
|
-
if (stakeholderMatchId === undefined)
|
|
67
|
-
throw new Error(`Could not find stakeholder ID for ${normalizedStakeholder} in care flow ${careFlowId}`);
|
|
68
|
-
return stakeholderMatchId;
|
|
69
|
-
};
|
|
70
|
-
const stakeholderId = await getStakeholderId(releaseId);
|
|
49
|
+
const stakeholderId = await (0, getStakeholderId_1.getStakeholderId)({
|
|
50
|
+
awellSdk: sdk,
|
|
51
|
+
pathwayId: careFlowId,
|
|
52
|
+
releaseId,
|
|
53
|
+
patientId,
|
|
54
|
+
stakeholder,
|
|
55
|
+
});
|
|
71
56
|
const res = await sdk.orchestration.mutation({
|
|
72
57
|
startHostedActivitySession: {
|
|
73
58
|
__args: {
|
package/dist/extensions/awell/v1/actions/startHostedPagesSession/startHostedPagesSession.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startHostedPagesSession.js","sourceRoot":"","sources":["../../../../../../extensions/awell/v1/actions/startHostedPagesSession/startHostedPagesSession.ts"],"names":[],"mappings":";;;AAEA,mEAAkE;AAClE,qCAAqE;AACrE,6BAAuB;AACvB,0EAA8E;
|
|
1
|
+
{"version":3,"file":"startHostedPagesSession.js","sourceRoot":"","sources":["../../../../../../extensions/awell/v1/actions/startHostedPagesSession/startHostedPagesSession.ts"],"names":[],"mappings":";;;AAEA,mEAAkE;AAClE,qCAAqE;AACrE,6BAAuB;AACvB,0EAA8E;AAC9E,oFAAgF;AAEhF,MAAM,KAAK,GAAG,KAAK,EAAE,EAAU,EAAiB,EAAE;IAChD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC/D,CAAC,CAAA;AAEY,QAAA,uBAAuB,GAA2C;IAC7E,GAAG,EAAE,yBAAyB;IAC9B,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,KAAK,EAAE,4BAA4B;IACnC,WAAW,EAAE,0DAA0D;IACvE,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,KAAK;IAClB,0BAA0B,EAAE,IAAI;IAChC,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;;QAC1E,OAAO,CAAC,GAAG,CACT,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EAC1B,oCAAoC,CACrC,CAAA;QAED,IAAI,CAAC;YACH,MAAM,EACJ,MAAM,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,GACpC,GAAG,IAAA,0BAAQ,EAAC;gBACX,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;oBACf,MAAM,EAAE,+BAAsB;iBAC/B,CAAC;gBACF,OAAO;aACR,CAAC,CAAA;YAEF,4EAA4E;YAC5E,MAAM,KAAK,CAAC,IAAI,CAAC,CAAA;YAEjB,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAA;YAEpC,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,KAAK,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C,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,GAAY,CAAC,CAAA;YAC3C,MAAM,KAAK,GAAG,GAAY,CAAA;YAC1B,MAAM,OAAO,CAAC;gBACZ,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE;wBAC3B,KAAK,EAAE;4BACL,QAAQ,EAAE,cAAc;4BACxB,OAAO,EAAE,KAAK,CAAC,OAAO;yBACvB;qBACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA"}
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"changelog": "# CHANGELOG"
|
|
13
13
|
},
|
|
14
14
|
"awell": {
|
|
15
|
-
"readme": "---\ntitle: Awell Workflow\ndescription: Enrich your care flows with powerful Awell actions.\n---\n\n# Awell API extension\n\n## Extension settings\n\nYou will need to provide the [API URL](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/endpoints) and an [API key](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/authorization).\n\n## Custom Actions\n\n### Start care flow\n\nStarts a new care flow for the patient enrolled in your current care flow.\n\n**Passing baseline info:**\nPlease read the documentation on [our developer hub](https://developers.awellhealth.com/awell-orchestration/api-reference/mutations/start-pathway) to learn more about how to pass baseline info.\n\n**Example of how to configure a value for the baseline info action field:**\n\n```json\n[\n {\n \"data_point_definition_id\": \"age\",\n \"value\": \"29\"\n },\n {\n \"data_point_definition_id\": \"dob\",\n \"value\": \"1993-11-30\"\n }\n]\n```\n\n### Stop care flow\n\nStops the care flow the patient is currently enrolled in. A reason is why you are stopping the care flow is mandatory.\n\n### Update patient\n\nAllows updating patient data for the patient currently enrolled in the care flow.\n\n### Is patient already enrolled in care flow\n\nChecks whether the patient is already enrolled in a care flow definition. The care flow the patient is currently enrolled in does not count and is excluded from the results.\n\n**Action fields:**\n\n- pathwayStatus: a comma-separated string of care flow statuses that will be used when looking for care flows the patient is already enrolled in. By default, we only look at active care flows. Options: \"active\", \"completed\", \"missing_baseline_info\", \"starting\", and \"stopped\".\n- careFlowDefinitionIds: a comma-separated string of care flow definition ids that will be used when looking for care flows the patient is already enrolled in. By default, we only search for care flows that match the current care flow definition id (i.e. is the patient already included in the current care flow?).\n\n**Data points:**\n\n- result: a boolean indicating whether the patient is already enrolled in another care flow that matches your criteria (status & care flow definition id)\n- nbrOfResults: the number of care flows found for the patient that match the criteria.\n- careFlowIds: a comma-separated string of care flow ids that matched your search criteria. It will be empty when the result is `false` because then there are no other care flow ids that match your criteria.\n\n### Search patients by patient code\n\nNote that this action is deprecated and we recommend using [identifiers](https://developers.awellhealth.com/awell-orchestration/docs/misc/patient-identifiers) instead.\n\nSearch whether, apart from the patient currently enrolled in the care flow, another patient with the same `patient_code` already exists.\n\n**Data points:**\n\n1. patientAlreadyExists: a boolean which will be true if minimum one patient with the patient code already exists.\n2. numberOfPatientsFound: the number of patients found with the same patient code.\n3. awellPatientIds: a comma-separated string of all Awell patient ids (except the current patient) that have the same patient code as the patient currently enrolled in the care flow. Will return an empty string when there are no other patients with the same patient code.\n\n### Get patient by identifier\n\nThis action lets you check if a patient with a specific identifier already exists in Awell. It's particularly useful when a patient's identity is initially anonymous during the start of the care flow, but later becomes identifiable through the identifiers collected during the care flow. This check ensures whether a patient with that identifier is already present or not.\n\n### Add identifier to patient\n\nThis action allows you to add a unique identifier to the current patient's profile. If the patient already has an identifier with the same system but a different value, this action will update the existing identifier with the new value provided. \n\nFirst, it checks if this identifier (system and value) is already associated with another patient. If it's safe to proceed, it will add or update the identifier as needed. However, if another patient already has this identifier, the action will stop and notify you, preventing duplicates. To avoid conflicts, we recommend first running the \"Get patient by identifier\" action to check for any existing matches.\n\n### Get data point value\n\nThis action allows you to read the most recent data point value of a given data point definition id from a care flow different from the current one. The action returns multiple data points, each with a different value type. Pick the one you need from the returned data points based on the value type of the data point you want to read the value from.\n\n**Example:**\nIf the data point you want to read the value from is of type `number`, then you should use the `valueNumber` data point.\n\n## Webhooks\n\nWebhooks in the Awell extension offer ways to trigger a care flow based on the end of another care flow, or from any event that happens in your system (via the pathwayStart webhook).\n",
|
|
16
|
-
"changelog": "# Awell changelog\n\n## April 2024\n\nTwo new action were added: \"Get patient by identifier\" and \"Add identifier to patient\".\n\n## October 26, 2023\n\nGeneric webhook to start a care flow added\n\n## April 19, 2023\n\nStop care flow action added.\nSearch patients by patient code action was added.\n\"Is patient enrolled in care flow\" action added.\n"
|
|
15
|
+
"readme": "---\ntitle: Awell Workflow\ndescription: Enrich your care flows with powerful Awell actions.\n---\n\n# Awell API extension\n\n## Extension settings\n\nYou will need to provide the [API URL](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/endpoints) and an [API key](https://developers.awellhealth.com/awell-orchestration/api-reference/overview/authorization).\n\n## Custom Actions\n\n### Start care flow\n\nStarts a new care flow for the patient enrolled in your current care flow.\n\n**Passing baseline info:**\nPlease read the documentation on [our developer hub](https://developers.awellhealth.com/awell-orchestration/api-reference/mutations/start-pathway) to learn more about how to pass baseline info.\n\n**Example of how to configure a value for the baseline info action field:**\n\n```json\n[\n {\n \"data_point_definition_id\": \"age\",\n \"value\": \"29\"\n },\n {\n \"data_point_definition_id\": \"dob\",\n \"value\": \"1993-11-30\"\n }\n]\n```\n\n### Stop care flow\n\nStops the care flow the patient is currently enrolled in. A reason is why you are stopping the care flow is mandatory.\n\n### Update patient\n\nAllows updating patient data for the patient currently enrolled in the care flow.\n\n### Is patient already enrolled in care flow\n\nChecks whether the patient is already enrolled in a care flow definition. The care flow the patient is currently enrolled in does not count and is excluded from the results.\n\n**Action fields:**\n\n- pathwayStatus: a comma-separated string of care flow statuses that will be used when looking for care flows the patient is already enrolled in. By default, we only look at active care flows. Options: \"active\", \"completed\", \"missing_baseline_info\", \"starting\", and \"stopped\".\n- careFlowDefinitionIds: a comma-separated string of care flow definition ids that will be used when looking for care flows the patient is already enrolled in. By default, we only search for care flows that match the current care flow definition id (i.e. is the patient already included in the current care flow?).\n\n**Data points:**\n\n- result: a boolean indicating whether the patient is already enrolled in another care flow that matches your criteria (status & care flow definition id)\n- nbrOfResults: the number of care flows found for the patient that match the criteria.\n- careFlowIds: a comma-separated string of care flow ids that matched your search criteria. It will be empty when the result is `false` because then there are no other care flow ids that match your criteria.\n\n### Search patients by patient code\n\nNote that this action is deprecated and we recommend using [identifiers](https://developers.awellhealth.com/awell-orchestration/docs/misc/patient-identifiers) instead.\n\nSearch whether, apart from the patient currently enrolled in the care flow, another patient with the same `patient_code` already exists.\n\n**Data points:**\n\n1. patientAlreadyExists: a boolean which will be true if minimum one patient with the patient code already exists.\n2. numberOfPatientsFound: the number of patients found with the same patient code.\n3. awellPatientIds: a comma-separated string of all Awell patient ids (except the current patient) that have the same patient code as the patient currently enrolled in the care flow. Will return an empty string when there are no other patients with the same patient code.\n\n### Get patient by identifier\n\nThis action lets you check if a patient with a specific identifier already exists in Awell. It's particularly useful when a patient's identity is initially anonymous during the start of the care flow, but later becomes identifiable through the identifiers collected during the care flow. This check ensures whether a patient with that identifier is already present or not.\n\n### Add identifier to patient\n\nThis action allows you to add a unique identifier to the current patient's profile. If the patient already has an identifier with the same system but a different value, this action will update the existing identifier with the new value provided. \n\nFirst, it checks if this identifier (system and value) is already associated with another patient. If it's safe to proceed, it will add or update the identifier as needed. However, if another patient already has this identifier, the action will stop and notify you, preventing duplicates. To avoid conflicts, we recommend first running the \"Get patient by identifier\" action to check for any existing matches.\n\n### Get data point value\n\nThis action allows you to read the most recent data point value of a given data point definition id from a care flow different from the current one. The action returns multiple data points, each with a different value type. Pick the one you need from the returned data points based on the value type of the data point you want to read the value from.\n\n**Example:**\nIf the data point you want to read the value from is of type `number`, then you should use the `valueNumber` data point.\n\n### Get Hosted Pages Link\n\nFetches the static Hosted Pages link for a stakeholder in a care flow. Unlike \"Start Hosted Pages Session\", this does not start a session - it returns the persistent link that can be shared with (or re-used by) the stakeholder, e.g. to send it in a reminder message.\n\n**Action fields:**\n\n- careFlowId (required): the instance ID of the care flow to fetch the link for.\n- stakeholder (optional): the name of the stakeholder to fetch the link for. Defaults to the patient when left empty. There must be activity for the stakeholder in the care flow, otherwise no link exists yet and the action will error.\n\n**Data points:**\n\n- linkUrl: the static Hosted Pages link for the stakeholder.\n\n## Webhooks\n\nWebhooks in the Awell extension offer ways to trigger a care flow based on the end of another care flow, or from any event that happens in your system (via the pathwayStart webhook).\n",
|
|
16
|
+
"changelog": "# Awell changelog\n\n## Unreleased\n\n- New action \"Get Hosted Pages Link\": fetches the static Hosted Pages link for a stakeholder in a care flow. The stakeholder field is optional and defaults to the patient when left empty.\n\n## April 2024\n\nTwo new action were added: \"Get patient by identifier\" and \"Add identifier to patient\".\n\n## October 26, 2023\n\nGeneric webhook to start a care flow added\n\n## April 19, 2023\n\nStop care flow action added.\nSearch patients by patient code action was added.\n\"Is patient enrolled in care flow\" action added.\n"
|
|
17
17
|
},
|
|
18
18
|
"awellTasks": {
|
|
19
19
|
"readme": "---\ntitle: Awell Tasks\ndescription: Awell Tasks is an extension that allows communication with the Task Service module.\n---\n\n# Awell Tasks\n\nAwell Tasks is an extension that allows communication with the Task Service module.\n",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AwellSdk } from '@awell-health/awell-sdk';
|
|
2
|
+
type GetStakeholderIdType = ({ awellSdk, pathwayId, releaseId, patientId, stakeholder, }: {
|
|
3
|
+
awellSdk: AwellSdk;
|
|
4
|
+
pathwayId: string;
|
|
5
|
+
releaseId: string;
|
|
6
|
+
patientId?: string;
|
|
7
|
+
stakeholder: string;
|
|
8
|
+
}) => Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the `stakeholder_id` to use for a given stakeholder name.
|
|
11
|
+
*
|
|
12
|
+
* For the patient stakeholder we must use the patient's actual id so the
|
|
13
|
+
* result matches the behaviour of the patient hosted pages link. All other
|
|
14
|
+
* stakeholders (e.g. care team) are role-based and are resolved to their
|
|
15
|
+
* release stakeholder-definition id.
|
|
16
|
+
*/
|
|
17
|
+
export declare const getStakeholderId: GetStakeholderIdType;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStakeholderId = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the `stakeholder_id` to use for a given stakeholder name.
|
|
6
|
+
*
|
|
7
|
+
* For the patient stakeholder we must use the patient's actual id so the
|
|
8
|
+
* result matches the behaviour of the patient hosted pages link. All other
|
|
9
|
+
* stakeholders (e.g. care team) are role-based and are resolved to their
|
|
10
|
+
* release stakeholder-definition id.
|
|
11
|
+
*/
|
|
12
|
+
const getStakeholderId = async ({ awellSdk, pathwayId, releaseId, patientId, stakeholder, }) => {
|
|
13
|
+
const normalizedStakeholder = stakeholder.toLowerCase();
|
|
14
|
+
const stakeholdersInRelease = await awellSdk.orchestration.query({
|
|
15
|
+
stakeholdersByReleaseIds: {
|
|
16
|
+
__args: {
|
|
17
|
+
release_ids: [releaseId],
|
|
18
|
+
},
|
|
19
|
+
success: true,
|
|
20
|
+
stakeholders: {
|
|
21
|
+
id: true,
|
|
22
|
+
label: {
|
|
23
|
+
en: true,
|
|
24
|
+
},
|
|
25
|
+
definition_id: true,
|
|
26
|
+
clinical_app_role: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const stakeholderMatch = stakeholdersInRelease.stakeholdersByReleaseIds.stakeholders.find((s) => s.label.en.toLowerCase() === normalizedStakeholder);
|
|
31
|
+
if (stakeholderMatch === undefined)
|
|
32
|
+
throw new Error(`Could not find stakeholder ID for ${normalizedStakeholder} in care flow ${pathwayId}`);
|
|
33
|
+
if (stakeholderMatch.clinical_app_role === 'PATIENT') {
|
|
34
|
+
if (patientId === undefined)
|
|
35
|
+
throw new Error(`Could not retrieve the patient ID for care flow ${pathwayId}.`);
|
|
36
|
+
return patientId;
|
|
37
|
+
}
|
|
38
|
+
return stakeholderMatch.id;
|
|
39
|
+
};
|
|
40
|
+
exports.getStakeholderId = getStakeholderId;
|
|
41
|
+
//# sourceMappingURL=getStakeholderId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getStakeholderId.js","sourceRoot":"","sources":["../../../../../src/lib/awell/getStakeholderId/getStakeholderId.ts"],"names":[],"mappings":";;;AAgBA;;;;;;;GAOG;AACI,MAAM,gBAAgB,GAAyB,KAAK,EAAE,EAC3D,QAAQ,EACR,SAAS,EACT,SAAS,EACT,SAAS,EACT,WAAW,GACZ,EAAE,EAAE;IACH,MAAM,qBAAqB,GAAG,WAAW,CAAC,WAAW,EAAE,CAAA;IAEvD,MAAM,qBAAqB,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;QAC/D,wBAAwB,EAAE;YACxB,MAAM,EAAE;gBACN,WAAW,EAAE,CAAC,SAAS,CAAC;aACzB;YACD,OAAO,EAAE,IAAI;YACb,YAAY,EAAE;gBACZ,EAAE,EAAE,IAAI;gBACR,KAAK,EAAE;oBACL,EAAE,EAAE,IAAI;iBACT;gBACD,aAAa,EAAE,IAAI;gBACnB,iBAAiB,EAAE,IAAI;aACxB;SACF;KACF,CAAC,CAAA;IAEF,MAAM,gBAAgB,GACpB,qBAAqB,CAAC,wBAAwB,CAAC,YAAY,CAAC,IAAI,CAC9D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,qBAAqB,CAC1D,CAAA;IAEH,IAAI,gBAAgB,KAAK,SAAS;QAChC,MAAM,IAAI,KAAK,CACb,qCAAqC,qBAAqB,iBAAiB,SAAS,EAAE,CACvF,CAAA;IAEH,IAAI,gBAAgB,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACrD,IAAI,SAAS,KAAK,SAAS;YACzB,MAAM,IAAI,KAAK,CACb,mDAAmD,SAAS,GAAG,CAChE,CAAA;QAEH,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO,gBAAgB,CAAC,EAAE,CAAA;AAC5B,CAAC,CAAA;AA9CY,QAAA,gBAAgB,oBA8C5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getStakeholderId';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./getStakeholderId"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/awell/getStakeholderId/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC"}
|
|
@@ -21,4 +21,5 @@ __exportStar(require("./getEmailValidationRegex"), exports);
|
|
|
21
21
|
__exportStar(require("./getLastCalculationActivityInCurrentStep"), exports);
|
|
22
22
|
__exportStar(require("./addEventLog"), exports);
|
|
23
23
|
__exportStar(require("./resolveStudioIds"), exports);
|
|
24
|
+
__exportStar(require("./getStakeholderId"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/awell/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA4C;AAC5C,6DAA0C;AAC1C,oDAAiC;AACjC,4DAAyC;AACzC,4EAAyD;AACzD,gDAA6B;AAC7B,qDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/awell/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA4C;AAC5C,6DAA0C;AAC1C,oDAAiC;AACjC,4DAAyC;AACzC,4EAAyD;AACzD,gDAA6B;AAC7B,qDAAkC;AAClC,qDAAkC"}
|