@awell-health/awell-extensions 2.0.105 → 2.0.106
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,18 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAllFormsInCurrentStep = void 0;
|
4
4
|
const lodash_1 = require("lodash");
|
5
5
|
const getAllFormsInCurrentStep = async ({ awellSdk, pathwayId, activityId, }) => {
|
6
|
-
var _a;
|
7
|
-
const
|
8
|
-
|
6
|
+
var _a, _b;
|
7
|
+
const activity_response = await awellSdk.orchestration.query({
|
8
|
+
activity: {
|
9
9
|
__args: {
|
10
|
-
|
11
|
-
pagination: {
|
12
|
-
offset: 0,
|
13
|
-
count: 500,
|
14
|
-
},
|
10
|
+
id: activityId,
|
15
11
|
},
|
16
12
|
success: true,
|
17
|
-
|
13
|
+
activity: {
|
18
14
|
id: true,
|
19
15
|
status: true,
|
20
16
|
date: true,
|
@@ -27,20 +23,40 @@ const getAllFormsInCurrentStep = async ({ awellSdk, pathwayId, activityId, }) =>
|
|
27
23
|
},
|
28
24
|
},
|
29
25
|
},
|
26
|
+
}).catch((error) => {
|
27
|
+
console.error(`Failed to fetch activity ${activityId}`, error);
|
28
|
+
throw new Error(`Failed to fetch activity ${activityId}`);
|
30
29
|
});
|
31
|
-
const currentActivity =
|
32
|
-
if ((0, lodash_1.isNil)(currentActivity))
|
33
|
-
throw new Error(
|
34
|
-
const currentStepId = (
|
30
|
+
const currentActivity = (_a = activity_response === null || activity_response === void 0 ? void 0 : activity_response.activity) === null || _a === void 0 ? void 0 : _a.activity;
|
31
|
+
if ((0, lodash_1.isNil)(currentActivity) || !activity_response.activity.success)
|
32
|
+
throw new Error(`Failed to fetch activity ${activityId}`);
|
33
|
+
const currentStepId = (_b = currentActivity.context) === null || _b === void 0 ? void 0 : _b.step_id;
|
35
34
|
if ((0, lodash_1.isNil)(currentStepId))
|
36
35
|
throw new Error('Could not find step ID of the current activity');
|
37
|
-
const
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
const activities = await awellSdk.orchestration.query({
|
37
|
+
pathwayStepActivities: {
|
38
|
+
__args: {
|
39
|
+
pathway_id: pathwayId,
|
40
|
+
step_id: currentStepId,
|
41
|
+
},
|
42
|
+
success: true,
|
43
|
+
activities: {
|
44
|
+
id: true,
|
45
|
+
status: true,
|
46
|
+
date: true,
|
47
|
+
object: {
|
48
|
+
id: true,
|
49
|
+
type: true,
|
50
|
+
},
|
51
|
+
context: {
|
52
|
+
step_id: true,
|
53
|
+
},
|
54
|
+
},
|
55
|
+
},
|
43
56
|
});
|
57
|
+
const formActivitiesInCurrentStep = activities.pathwayStepActivities.activities.filter((a) => a.object.type === 'FORM' &&
|
58
|
+
a.status === 'DONE' &&
|
59
|
+
a.date <= currentActivity.date);
|
44
60
|
if ((0, lodash_1.isEmpty)(formActivitiesInCurrentStep))
|
45
61
|
return [];
|
46
62
|
const getFormDefinitionAndFormResponse = async (formActivity) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getAllFormsInCurrentStep.js","sourceRoot":"","sources":["../../../../../src/lib/awell/getAllFormsInCurrentStep/getAllFormsInCurrentStep.ts"],"names":[],"mappings":";;;AAMA,mCAAuC;AAmBhC,MAAM,wBAAwB,GAA6B,KAAK,EAAE,EACvE,QAAQ,EACR,SAAS,EACT,UAAU,GACX,EAAE,EAAE;;
|
1
|
+
{"version":3,"file":"getAllFormsInCurrentStep.js","sourceRoot":"","sources":["../../../../../src/lib/awell/getAllFormsInCurrentStep/getAllFormsInCurrentStep.ts"],"names":[],"mappings":";;;AAMA,mCAAuC;AAmBhC,MAAM,wBAAwB,GAA6B,KAAK,EAAE,EACvE,QAAQ,EACR,SAAS,EACT,UAAU,GACX,EAAE,EAAE;;IAEH,MAAM,iBAAiB,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;QAC3D,QAAQ,EAAE;YACR,MAAM,EAAE;gBACN,EAAE,EAAE,UAAU;aACf;YACD,OAAO,EAAE,IAA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C,KAAK,EAAE,YAAY,EAAE,EAAE;QACrD,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GACpC,MAAM,gCAAgC,CAAC,YAAwB,CAAC,CAAA;QAElE,OAAO;YACL,cAAc,EAAE,YAAY,CAAC,EAAE;YAC/B,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE;YAC9B,cAAc;YACd,YAAY;SACb,CAAA;IACH,CAAC,CAAC,CACH,CAAA;AACH,CAAC,CAAA;AA9HY,QAAA,wBAAwB,4BA8HpC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@awell-health/awell-extensions",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.106",
|
4
4
|
"packageManager": "yarn@3.4.1",
|
5
5
|
"main": "dist/src/index.js",
|
6
6
|
"repository": {
|
@@ -74,7 +74,7 @@
|
|
74
74
|
"typescript": "4.9.5"
|
75
75
|
},
|
76
76
|
"dependencies": {
|
77
|
-
"@awell-health/awell-sdk": "^0.1.
|
77
|
+
"@awell-health/awell-sdk": "^0.1.20",
|
78
78
|
"@awell-health/extensions-core": "1.0.11",
|
79
79
|
"@dropbox/sign": "^1.1.3",
|
80
80
|
"@genql/cli": "^6.3.3",
|