dataverse-utils 2.4.0 → 2.4.1
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.
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deployImage = void 0;
|
|
4
4
|
const logger_1 = require("../logger");
|
|
5
5
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
6
|
-
async function deployImage(stepId, image, message, apiConfig) {
|
|
6
|
+
async function deployImage(stepId, stepName, image, message, apiConfig) {
|
|
7
7
|
image['sdkmessageprocessingstepid@odata.bind'] = `/sdkmessageprocessingsteps(${stepId})`;
|
|
8
8
|
switch (message) {
|
|
9
9
|
case 'Create':
|
|
@@ -25,7 +25,7 @@ async function deployImage(stepId, image, message, apiConfig) {
|
|
|
25
25
|
let imageId = await retrieveImage(stepId, image, apiConfig);
|
|
26
26
|
if (imageId != '') {
|
|
27
27
|
try {
|
|
28
|
-
await updateImage(imageId, image, apiConfig);
|
|
28
|
+
await updateImage(imageId, image, stepName, apiConfig);
|
|
29
29
|
}
|
|
30
30
|
catch (error) {
|
|
31
31
|
throw new Error(`failed to update plugin image: ${error.message}`);
|
|
@@ -33,7 +33,7 @@ async function deployImage(stepId, image, message, apiConfig) {
|
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
try {
|
|
36
|
-
imageId = await createImage(image, apiConfig);
|
|
36
|
+
imageId = await createImage(image, stepName, apiConfig);
|
|
37
37
|
}
|
|
38
38
|
catch (error) {
|
|
39
39
|
throw new Error(`failed to create plugin image: ${error.message}`);
|
|
@@ -47,15 +47,15 @@ async function retrieveImage(stepId, image, apiConfig) {
|
|
|
47
47
|
const result = await (0, node_1.retrieveMultiple)(apiConfig, 'sdkmessageprocessingstepimages', options);
|
|
48
48
|
return result.value.length > 0 ? result.value[0].sdkmessageprocessingstepimageid : '';
|
|
49
49
|
}
|
|
50
|
-
async function createImage(image, apiConfig) {
|
|
51
|
-
logger_1.logger.info(`create plugin image ${image.name}`);
|
|
50
|
+
async function createImage(image, stepName, apiConfig) {
|
|
51
|
+
logger_1.logger.info(`create plugin image ${image.name} for step ${stepName}`);
|
|
52
52
|
const result = await (0, node_1.createWithReturnData)(apiConfig, 'sdkmessageprocessingstepimages', image, '$select=sdkmessageprocessingstepimageid');
|
|
53
53
|
if (result.error) {
|
|
54
54
|
throw new Error(result.error.message);
|
|
55
55
|
}
|
|
56
56
|
return result.sdkmessageprocessingstepimageid;
|
|
57
57
|
}
|
|
58
|
-
async function updateImage(id, image, apiConfig) {
|
|
59
|
-
logger_1.logger.info(`update plugin image ${image.name}`);
|
|
58
|
+
async function updateImage(id, image, stepName, apiConfig) {
|
|
59
|
+
logger_1.logger.info(`update plugin image ${image.name} for step ${stepName}`);
|
|
60
60
|
return (0, node_1.update)(apiConfig, 'sdkmessageprocessingstepimages', id, image);
|
|
61
61
|
}
|
package/lib/models/pluginStep.js
CHANGED
|
@@ -53,7 +53,7 @@ async function deployStep(step, typeId, apiConfig, solution) {
|
|
|
53
53
|
}
|
|
54
54
|
if (images && images.length > 0) {
|
|
55
55
|
try {
|
|
56
|
-
const promises = images.map(image => (0, pluginImage_1.deployImage)(stepId, image, message, apiConfig));
|
|
56
|
+
const promises = images.map(image => (0, pluginImage_1.deployImage)(stepId, step.name, image, message, apiConfig));
|
|
57
57
|
await Promise.all(promises);
|
|
58
58
|
}
|
|
59
59
|
catch (error) {
|