@awell-health/awell-extensions 2.1.47 → 2.1.49
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/docuSign/actions/generateSignUrlForExistingEnvelope/config/fields.d.ts +20 -0
- package/dist/extensions/docuSign/actions/generateSignUrlForExistingEnvelope/config/fields.js +17 -1
- package/dist/extensions/docuSign/actions/generateSignUrlForExistingEnvelope/config/fields.js.map +1 -1
- package/dist/extensions/docuSign/actions/generateSignUrlForExistingEnvelope/generateSignUrlForExistingEnvelope.js +16 -3
- package/dist/extensions/docuSign/actions/generateSignUrlForExistingEnvelope/generateSignUrlForExistingEnvelope.js.map +1 -1
- 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
package/dist/extensions/docuSign/actions/generateSignUrlForExistingEnvelope/config/fields.d.ts
CHANGED
|
@@ -8,6 +8,13 @@ export declare const fields: {
|
|
|
8
8
|
type: FieldType.STRING;
|
|
9
9
|
required: true;
|
|
10
10
|
};
|
|
11
|
+
signerRole: {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
description: string;
|
|
15
|
+
type: FieldType.STRING;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
11
18
|
signerName: {
|
|
12
19
|
id: string;
|
|
13
20
|
label: string;
|
|
@@ -29,20 +36,33 @@ export declare const fields: {
|
|
|
29
36
|
type: FieldType.STRING;
|
|
30
37
|
required: true;
|
|
31
38
|
};
|
|
39
|
+
routingOrder: {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
description: string;
|
|
43
|
+
type: FieldType.STRING;
|
|
44
|
+
required: true;
|
|
45
|
+
};
|
|
32
46
|
};
|
|
33
47
|
export declare const FieldsValidationSchema: z.ZodObject<{
|
|
34
48
|
envelopeId: z.ZodString;
|
|
49
|
+
signerRole: z.ZodString;
|
|
35
50
|
signerName: z.ZodString;
|
|
36
51
|
signerEmail: z.ZodString;
|
|
37
52
|
clientUserId: z.ZodString;
|
|
53
|
+
routingOrder: z.ZodString;
|
|
38
54
|
}, "strip", z.ZodTypeAny, {
|
|
39
55
|
envelopeId: string;
|
|
56
|
+
signerRole: string;
|
|
40
57
|
signerName: string;
|
|
41
58
|
signerEmail: string;
|
|
42
59
|
clientUserId: string;
|
|
60
|
+
routingOrder: string;
|
|
43
61
|
}, {
|
|
44
62
|
envelopeId: string;
|
|
63
|
+
signerRole: string;
|
|
45
64
|
signerName: string;
|
|
46
65
|
signerEmail: string;
|
|
47
66
|
clientUserId: string;
|
|
67
|
+
routingOrder: string;
|
|
48
68
|
}>;
|
package/dist/extensions/docuSign/actions/generateSignUrlForExistingEnvelope/config/fields.js
CHANGED
|
@@ -11,6 +11,13 @@ exports.fields = {
|
|
|
11
11
|
type: extensions_core_1.FieldType.STRING,
|
|
12
12
|
required: true,
|
|
13
13
|
},
|
|
14
|
+
signerRole: {
|
|
15
|
+
id: 'signerRole',
|
|
16
|
+
label: 'Signer role',
|
|
17
|
+
description: 'Must match an existing role in the template used to create the envelope. It\'s case-sensitive.',
|
|
18
|
+
type: extensions_core_1.FieldType.STRING,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
14
21
|
signerName: {
|
|
15
22
|
id: 'signerName',
|
|
16
23
|
label: 'Signer name',
|
|
@@ -21,7 +28,7 @@ exports.fields = {
|
|
|
21
28
|
signerEmail: {
|
|
22
29
|
id: 'signerEmail',
|
|
23
30
|
label: 'Signer email',
|
|
24
|
-
description: 'The email address of the person who will sign the document.
|
|
31
|
+
description: 'The email address of the person who will sign the document.',
|
|
25
32
|
type: extensions_core_1.FieldType.STRING,
|
|
26
33
|
required: true,
|
|
27
34
|
},
|
|
@@ -32,11 +39,20 @@ exports.fields = {
|
|
|
32
39
|
type: extensions_core_1.FieldType.STRING,
|
|
33
40
|
required: true,
|
|
34
41
|
},
|
|
42
|
+
routingOrder: {
|
|
43
|
+
id: 'routingOrder',
|
|
44
|
+
label: 'Routing order',
|
|
45
|
+
description: 'The signing order for this recipient. Use "1" for the first signer, "2" for the second, etc. For sequential signing, this determines when the recipient can sign.',
|
|
46
|
+
type: extensions_core_1.FieldType.STRING,
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
35
49
|
};
|
|
36
50
|
exports.FieldsValidationSchema = zod_1.z.object({
|
|
37
51
|
envelopeId: zod_1.z.string(),
|
|
52
|
+
signerRole: zod_1.z.string(),
|
|
38
53
|
signerName: zod_1.z.string(),
|
|
39
54
|
signerEmail: zod_1.z.string(),
|
|
40
55
|
clientUserId: zod_1.z.string(),
|
|
56
|
+
routingOrder: zod_1.z.string(),
|
|
41
57
|
});
|
|
42
58
|
//# sourceMappingURL=fields.js.map
|
package/dist/extensions/docuSign/actions/generateSignUrlForExistingEnvelope/config/fields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/docuSign/actions/generateSignUrlForExistingEnvelope/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,6BAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,+HAA+H;QAC5I,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/docuSign/actions/generateSignUrlForExistingEnvelope/config/fields.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,6BAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,+HAA+H;QAC5I,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,gGAAgG;QAC7G,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,6DAA6D;QAC1E,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,8IAA8I;QAC3J,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,mKAAmK;QAChL,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;CACyB,CAAC,CAAA"}
|
|
@@ -15,15 +15,15 @@ const types_1 = require("../createEmbeddedSignatureRequestWithTemplate/config/ty
|
|
|
15
15
|
const utils_1 = require("../createEmbeddedSignatureRequestWithTemplate/config/utils");
|
|
16
16
|
exports.generateSignUrlForExistingEnvelope = {
|
|
17
17
|
key: 'generateSignUrlForExistingEnvelope',
|
|
18
|
-
title: '
|
|
19
|
-
description: '
|
|
18
|
+
title: 'Add recipient and generate sign URL',
|
|
19
|
+
description: 'Add a recipient to an existing DocuSign envelope and generate their signing URL. Perfect for sequential signing workflows where the first signer completes, then you add the next signer to the same document.',
|
|
20
20
|
category: extensions_core_2.Category.DOCUMENT_MANAGEMENT,
|
|
21
21
|
fields: config_1.fields,
|
|
22
22
|
dataPoints: config_1.dataPoints,
|
|
23
23
|
previewable: true,
|
|
24
24
|
onEvent: async ({ payload, onComplete, onError }) => {
|
|
25
25
|
const { patient: { id: patientId }, pathway: { id: pathwayId }, activity: { id: activityId, sessionId }, } = payload;
|
|
26
|
-
const { settings: { accountId, baseApiUrl, returnUrlTemplate, integrationKey, rsaKey, userId, }, fields: { envelopeId, signerName, signerEmail, clientUserId }, } = (0, extensions_core_1.validate)({
|
|
26
|
+
const { settings: { accountId, baseApiUrl, returnUrlTemplate, integrationKey, rsaKey, userId, }, fields: { envelopeId, signerRole, signerName, signerEmail, clientUserId, routingOrder, }, } = (0, extensions_core_1.validate)({
|
|
27
27
|
schema: zod_1.z.object({
|
|
28
28
|
settings: settings_1.SettingsValidationSchema,
|
|
29
29
|
fields: config_1.FieldsValidationSchema,
|
|
@@ -38,6 +38,19 @@ exports.generateSignUrlForExistingEnvelope = {
|
|
|
38
38
|
baseUrl: baseApiUrl,
|
|
39
39
|
});
|
|
40
40
|
const envelopesApi = new docusign_esign_1.default.EnvelopesApi(client);
|
|
41
|
+
const templateRole = docusign_esign_1.default.TemplateRole.constructFromObject({
|
|
42
|
+
email: signerEmail,
|
|
43
|
+
name: signerName,
|
|
44
|
+
roleName: signerRole,
|
|
45
|
+
clientUserId,
|
|
46
|
+
routingOrder,
|
|
47
|
+
});
|
|
48
|
+
const recipients = docusign_esign_1.default.Recipients.constructFromObject({
|
|
49
|
+
signers: [templateRole],
|
|
50
|
+
});
|
|
51
|
+
await envelopesApi.updateRecipients(accountId, envelopeId, {
|
|
52
|
+
recipients,
|
|
53
|
+
});
|
|
41
54
|
const viewRequest = docusign_esign_1.default.RecipientViewRequest.constructFromObject({
|
|
42
55
|
authenticationMethod: 'none',
|
|
43
56
|
email: signerEmail,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSignUrlForExistingEnvelope.js","sourceRoot":"","sources":["../../../../../extensions/docuSign/actions/generateSignUrlForExistingEnvelope/generateSignUrlForExistingEnvelope.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,oEAAwC;AACxC,mEAAwD;AACxD,6BAAuB;AACvB,qCAAqE;AACrE,6CAAwE;AACxE,oGAAmG;AACnG,sFAAoG;AACpG,sFAAmG;AAEtF,QAAA,kCAAkC,GAG3C;IACF,GAAG,EAAE,oCAAoC;IACzC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"generateSignUrlForExistingEnvelope.js","sourceRoot":"","sources":["../../../../../extensions/docuSign/actions/generateSignUrlForExistingEnvelope/generateSignUrlForExistingEnvelope.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,oEAAwC;AACxC,mEAAwD;AACxD,6BAAuB;AACvB,qCAAqE;AACrE,6CAAwE;AACxE,oGAAmG;AACnG,sFAAoG;AACpG,sFAAmG;AAEtF,QAAA,kCAAkC,GAG3C;IACF,GAAG,EAAE,oCAAoC;IACzC,KAAK,EAAE,qCAAqC;IAC5C,WAAW,EACT,gNAAgN;IAClN,QAAQ,EAAE,0BAAQ,CAAC,mBAAmB;IACtC,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,EAAiB,EAAE;QACjE,MAAM,EACJ,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAC1B,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAC1B,QAAQ,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,GACxC,GAAG,OAAO,CAAA;QAEX,MAAM,EACJ,QAAQ,EAAE,EACR,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,MAAM,GACP,EACD,MAAM,EAAE,EACN,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,GACb,GACF,GAAG,IAAA,0BAAQ,EAAC;YACX,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,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,OAAO,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,GAAG;iBACzB;aACF,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,IAAA,+BAAuB,EAAC,GAAG,CAAC,EAAE,CAAC;gBACjC,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BAC9B,IAAI,EAAE;gCACJ,EAAE,EAAE,+BAA+B,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE;6BACvD;4BACD,KAAK,EAAE;gCACL,QAAQ,EAAE,aAAa;gCACvB,OAAO,EAAE,mBAAmB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE;6BACjF;yBACF;qBACF;iBACF,CAAC,CAAA;gBACF,OAAM;YACR,CAAC;YAED,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;CACF,CAAA"}
|
|
@@ -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,MAAM,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,YAAsB,CAAC,CAAA;gBAEpE,MAAM,WAAW,GACf,MAAA,MAAA,MAAM,CAAC,KAAK,0CACR,GAAG,CAAC,CAAC,KAAK,E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B;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"}
|