@awell-health/awell-extensions 2.1.47 → 2.1.48
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/medplum/actions/createResource/config/dataPoints.d.ts +22 -0
- package/dist/extensions/medplum/actions/createResource/config/dataPoints.js +26 -0
- package/dist/extensions/medplum/actions/createResource/config/dataPoints.js.map +1 -0
- package/dist/extensions/medplum/actions/createResource/config/fields.d.ts +18 -0
- package/dist/extensions/medplum/actions/createResource/config/fields.js +18 -0
- package/dist/extensions/medplum/actions/createResource/config/fields.js.map +1 -0
- package/dist/extensions/medplum/actions/createResource/config/index.d.ts +2 -0
- package/dist/extensions/medplum/actions/createResource/config/index.js +9 -0
- package/dist/extensions/medplum/actions/createResource/config/index.js.map +1 -0
- package/dist/extensions/medplum/actions/createResource/createResource.d.ts +4 -0
- package/dist/extensions/medplum/actions/createResource/createResource.js +68 -0
- package/dist/extensions/medplum/actions/createResource/createResource.js.map +1 -0
- package/dist/extensions/medplum/actions/createResource/index.d.ts +1 -0
- package/dist/extensions/medplum/actions/createResource/index.js +6 -0
- package/dist/extensions/medplum/actions/createResource/index.js.map +1 -0
- package/dist/extensions/medplum/actions/index.d.ts +1 -0
- package/dist/extensions/medplum/actions/index.js +3 -1
- package/dist/extensions/medplum/actions/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const dataPoints: {
|
|
2
|
+
resourceId: {
|
|
3
|
+
key: string;
|
|
4
|
+
valueType: "string";
|
|
5
|
+
};
|
|
6
|
+
resourceType: {
|
|
7
|
+
key: string;
|
|
8
|
+
valueType: "string";
|
|
9
|
+
};
|
|
10
|
+
bundleId: {
|
|
11
|
+
key: string;
|
|
12
|
+
valueType: "string";
|
|
13
|
+
};
|
|
14
|
+
bundleType: {
|
|
15
|
+
key: string;
|
|
16
|
+
valueType: "string";
|
|
17
|
+
};
|
|
18
|
+
resourceIds: {
|
|
19
|
+
key: string;
|
|
20
|
+
valueType: "string";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dataPoints = void 0;
|
|
4
|
+
exports.dataPoints = {
|
|
5
|
+
resourceId: {
|
|
6
|
+
key: 'resourceId',
|
|
7
|
+
valueType: 'string',
|
|
8
|
+
},
|
|
9
|
+
resourceType: {
|
|
10
|
+
key: 'resourceType',
|
|
11
|
+
valueType: 'string',
|
|
12
|
+
},
|
|
13
|
+
bundleId: {
|
|
14
|
+
key: 'bundleId',
|
|
15
|
+
valueType: 'string',
|
|
16
|
+
},
|
|
17
|
+
bundleType: {
|
|
18
|
+
key: 'bundleType',
|
|
19
|
+
valueType: 'string',
|
|
20
|
+
},
|
|
21
|
+
resourceIds: {
|
|
22
|
+
key: 'resourceIds',
|
|
23
|
+
valueType: 'string',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=dataPoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/medplum/actions/createResource/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,UAAU,EAAE;QACV,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,QAAQ;KACpB;IACD,YAAY,EAAE;QACZ,GAAG,EAAE,cAAc;QACnB,SAAS,EAAE,QAAQ;KACpB;IACD,QAAQ,EAAE;QACR,GAAG,EAAE,UAAU;QACf,SAAS,EAAE,QAAQ;KACpB;IACD,UAAU,EAAE;QACV,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,QAAQ;KACpB;IACD,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FieldType } from '@awell-health/extensions-core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const fields: {
|
|
4
|
+
resourceJson: {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
description: string;
|
|
8
|
+
type: FieldType.JSON;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const FieldsValidationSchema: z.ZodObject<{
|
|
13
|
+
resourceJson: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
resourceJson: string;
|
|
16
|
+
}, {
|
|
17
|
+
resourceJson: string;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 zod_1 = require("zod");
|
|
6
|
+
exports.fields = {
|
|
7
|
+
resourceJson: {
|
|
8
|
+
id: 'resourceJson',
|
|
9
|
+
label: 'Resource JSON',
|
|
10
|
+
description: 'FHIR resource or Bundle as JSON. Supports single resources (e.g., Patient, Observation) or FHIR Bundles (transaction/batch) for creating multiple resources.',
|
|
11
|
+
type: extensions_core_1.FieldType.JSON,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
exports.FieldsValidationSchema = zod_1.z.object({
|
|
16
|
+
resourceJson: zod_1.z.string().min(1),
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/medplum/actions/createResource/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,6BAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,8JAA8J;QAChK,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACkB,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/medplum/actions/createResource/config/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AACvC,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createResource = void 0;
|
|
4
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
|
5
|
+
const config_1 = require("./config");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
exports.createResource = {
|
|
8
|
+
key: 'createResource',
|
|
9
|
+
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
|
10
|
+
title: 'Create resource',
|
|
11
|
+
description: 'Create any FHIR resource in Medplum. Supports single resources or FHIR Bundles (transaction/batch) for creating multiple resources atomically.',
|
|
12
|
+
fields: config_1.fields,
|
|
13
|
+
previewable: false,
|
|
14
|
+
dataPoints: config_1.dataPoints,
|
|
15
|
+
onEvent: async ({ payload, onComplete, onError }) => {
|
|
16
|
+
var _a, _b, _c, _d, _e;
|
|
17
|
+
const { fields: input, medplumSdk, } = await (0, utils_1.validateAndCreateSdkClient)({
|
|
18
|
+
fieldsSchema: config_1.FieldsValidationSchema,
|
|
19
|
+
payload,
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
const resourceData = JSON.parse(input.resourceJson);
|
|
23
|
+
if (resourceData.resourceType === 'Bundle') {
|
|
24
|
+
const result = await medplumSdk.executeBatch(resourceData);
|
|
25
|
+
const resourceIds = (_b = (_a = result.entry) === null || _a === void 0 ? void 0 : _a.map((entry) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if ((_a = entry.response) === null || _a === void 0 ? void 0 : _a.location) {
|
|
28
|
+
const match = entry.response.location.match(/(?:^|\/)([^/]+)\/([^/]+)(?:\/|$)/);
|
|
29
|
+
return match ? match[2] : undefined;
|
|
30
|
+
}
|
|
31
|
+
return (_b = entry.resource) === null || _b === void 0 ? void 0 : _b.id;
|
|
32
|
+
}).filter(Boolean).join(',')) !== null && _b !== void 0 ? _b : '';
|
|
33
|
+
await onComplete({
|
|
34
|
+
data_points: {
|
|
35
|
+
bundleId: (_c = result.id) !== null && _c !== void 0 ? _c : '',
|
|
36
|
+
resourceIds,
|
|
37
|
+
bundleType: (_d = result.type) !== null && _d !== void 0 ? _d : '',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const result = await medplumSdk.createResource(resourceData);
|
|
43
|
+
await onComplete({
|
|
44
|
+
data_points: {
|
|
45
|
+
resourceId: (_e = result.id) !== null && _e !== void 0 ? _e : '',
|
|
46
|
+
resourceType: result.resourceType,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const err = error;
|
|
53
|
+
await onError({
|
|
54
|
+
events: [
|
|
55
|
+
{
|
|
56
|
+
date: new Date().toISOString(),
|
|
57
|
+
text: { en: `Failed to create resource: ${err.message}` },
|
|
58
|
+
error: {
|
|
59
|
+
category: 'SERVER_ERROR',
|
|
60
|
+
message: err.message,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=createResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createResource.js","sourceRoot":"","sources":["../../../../../extensions/medplum/actions/createResource/createResource.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,uCAAwD;AAG3C,QAAA,cAAc,GAIvB;IACF,GAAG,EAAE,gBAAgB;IACrB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,iBAAiB;IACxB,WAAW,EACT,gJAAgJ;IAClJ,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,EAAiB,EAAE;;QACjE,MAAM,EACJ,MAAM,EAAE,KAAK,EACb,UAAU,GACX,GAAG,MAAM,IAAA,kCAA0B,EAAC;YACnC,YAAY,EAAE,+BAAsB;YACpC,OAAO;SACR,CAAC,CAAA;QAEF,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAEnD,IAAI,YAAY,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;gBAC3C,MAAM,M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AE,EAAE,EAAE,EAAE,8BAA8B,GAAG,CAAC,OAAO,EAAE,EAAE;wBACzD,KAAK,EAAE;4BACL,QAAQ,EAAE,cAAc;4BACxB,OAAO,EAAE,GAAG,CAAC,OAAO;yBACrB;qBACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createResource } from './createResource';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createResource = void 0;
|
|
4
|
+
var createResource_1 = require("./createResource");
|
|
5
|
+
Object.defineProperty(exports, "createResource", { enumerable: true, get: function () { return createResource_1.createResource; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/medplum/actions/createResource/index.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAAxC,gHAAA,cAAc,OAAA"}
|
|
@@ -10,3 +10,4 @@ export { addSideEffect } from './addSideEffect';
|
|
|
10
10
|
export { getServiceRequest } from './getServiceRequest';
|
|
11
11
|
export { getMedicationRequest } from './getMedicationRequest';
|
|
12
12
|
export { searchPatient } from './searchPatient';
|
|
13
|
+
export { createResource } from './createResource';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.searchPatient = exports.getMedicationRequest = exports.getServiceRequest = exports.addSideEffect = exports.createCalculationObservation = exports.submitQuestionnaireResponse = exports.createServiceRequest = exports.createTask = exports.executeBot = exports.getAppointment = exports.createPatient = exports.getPatient = void 0;
|
|
3
|
+
exports.createResource = exports.searchPatient = exports.getMedicationRequest = exports.getServiceRequest = exports.addSideEffect = exports.createCalculationObservation = exports.submitQuestionnaireResponse = exports.createServiceRequest = exports.createTask = exports.executeBot = exports.getAppointment = exports.createPatient = exports.getPatient = void 0;
|
|
4
4
|
var getPatient_1 = require("./getPatient");
|
|
5
5
|
Object.defineProperty(exports, "getPatient", { enumerable: true, get: function () { return getPatient_1.getPatient; } });
|
|
6
6
|
var createPatient_1 = require("./createPatient");
|
|
@@ -25,4 +25,6 @@ var getMedicationRequest_1 = require("./getMedicationRequest");
|
|
|
25
25
|
Object.defineProperty(exports, "getMedicationRequest", { enumerable: true, get: function () { return getMedicationRequest_1.getMedicationRequest; } });
|
|
26
26
|
var searchPatient_1 = require("./searchPatient");
|
|
27
27
|
Object.defineProperty(exports, "searchPatient", { enumerable: true, get: function () { return searchPatient_1.searchPatient; } });
|
|
28
|
+
var createResource_1 = require("./createResource");
|
|
29
|
+
Object.defineProperty(exports, "createResource", { enumerable: true, get: function () { return createResource_1.createResource; } });
|
|
28
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/medplum/actions/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AACvB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA;AAC7B,6EAA2E;AAAlE,0IAAA,2BAA2B,OAAA;AACpC,+EAA6E;AAApE,4IAAA,4BAA4B,OAAA;AACrC,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAC1B,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA;AAC7B,iDAA+C;AAAtC,8GAAA,aAAa,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/medplum/actions/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AACvB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA;AAC7B,6EAA2E;AAAlE,0IAAA,2BAA2B,OAAA;AACpC,+EAA6E;AAApE,4IAAA,4BAA4B,OAAA;AACrC,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAC1B,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA;AAC7B,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA"}
|