dataverse-utils 2.4.0 → 2.5.0
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/lib/dataverse.service.js +2 -0
- package/lib/deploy.js +8 -4
- package/lib/index.js +1 -1
- package/lib/models/pluginImage.js +7 -7
- package/lib/models/pluginPackage.js +2 -2
- package/lib/models/pluginStep.js +1 -1
- package/license +1 -1
- package/package.json +2 -2
package/lib/dataverse.service.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTableMetadata = exports.publish = exports.addToSolution = exports.ComponentType = void 0;
|
|
4
4
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
5
|
+
const logger_1 = require("./logger");
|
|
5
6
|
var ComponentType;
|
|
6
7
|
(function (ComponentType) {
|
|
7
8
|
ComponentType[ComponentType["WebResource"] = 61] = "WebResource";
|
|
@@ -19,6 +20,7 @@ async function addToSolution(id, solution, type, apiConfig) {
|
|
|
19
20
|
AddRequiredComponents: false,
|
|
20
21
|
IncludedComponentSettingsValues: null
|
|
21
22
|
};
|
|
23
|
+
logger_1.logger.info(`add component ${id} to solution ${solution}`);
|
|
22
24
|
await (0, node_1.unboundAction)(apiConfig, 'AddSolutionComponent', data);
|
|
23
25
|
}
|
|
24
26
|
exports.addToSolution = addToSolution;
|
package/lib/deploy.js
CHANGED
|
@@ -12,15 +12,16 @@ const webResourceDeploy_1 = require("./webResourceDeploy");
|
|
|
12
12
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
13
13
|
const auth_1 = require("./auth");
|
|
14
14
|
async function deploy(type, files) {
|
|
15
|
-
if (!type || (type !== 'webresource' && type !== 'assembly')) {
|
|
16
|
-
const invalid = type !== undefined && type !== 'webresource' && type !== 'assembly';
|
|
17
|
-
const invalidMessage = invalid ? `${type} is not a valid project type
|
|
15
|
+
if (!type || (type !== 'webresource' && type !== 'assembly' && type !== 'pcf')) {
|
|
16
|
+
const invalid = type !== undefined && type !== 'webresource' && type !== 'assembly' && type !== 'pcf';
|
|
17
|
+
const invalidMessage = invalid ? `${type} is not a valid project type. ` : '';
|
|
18
18
|
const { typePrompt } = await (0, prompts_1.default)({
|
|
19
19
|
type: 'select',
|
|
20
20
|
name: 'typePrompt',
|
|
21
|
-
message: `${invalidMessage}
|
|
21
|
+
message: `${invalidMessage}select project type to deploy`,
|
|
22
22
|
choices: [
|
|
23
23
|
{ title: 'web resource', value: 'webresource' },
|
|
24
|
+
{ title: 'pcf', value: 'webresource' },
|
|
24
25
|
{ title: 'plugin or workflow activity', value: 'assembly' }
|
|
25
26
|
]
|
|
26
27
|
});
|
|
@@ -53,6 +54,9 @@ async function deploy(type, files) {
|
|
|
53
54
|
case 'assembly':
|
|
54
55
|
await (0, assemblyDeploy_1.assemblyDeploy)(creds, apiConfig);
|
|
55
56
|
break;
|
|
57
|
+
case 'pcf':
|
|
58
|
+
logger_1.logger.error('PCF deploy coming soon');
|
|
59
|
+
break;
|
|
56
60
|
default:
|
|
57
61
|
break;
|
|
58
62
|
}
|
package/lib/index.js
CHANGED
|
@@ -15,7 +15,7 @@ commander_1.program
|
|
|
15
15
|
// Deploy command
|
|
16
16
|
commander_1.program
|
|
17
17
|
.command('deploy')
|
|
18
|
-
.description('Deploy file(s) to dataverse (webresource,
|
|
18
|
+
.description('Deploy file(s) to dataverse (webresource, assembly, pcf)')
|
|
19
19
|
.argument('[type]', 'Type of project to deploy')
|
|
20
20
|
.argument('[files]', 'Comma separate list of files to deploy')
|
|
21
21
|
.action((type, files) => {
|
|
@@ -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
|
}
|
|
@@ -67,7 +67,7 @@ async function retrievePackage(prefix, name, apiConfig) {
|
|
|
67
67
|
return result.value.length > 0 ? result.value[0].pluginassemblyid : '';
|
|
68
68
|
}
|
|
69
69
|
async function createPackage(config, content, apiConfig) {
|
|
70
|
-
logger_1.logger.info(`create
|
|
70
|
+
logger_1.logger.info(`create package ${config.name}`);
|
|
71
71
|
const pluginPackage = {
|
|
72
72
|
name: `${config.prefix}_${config.name}`,
|
|
73
73
|
version: config.version,
|
|
@@ -80,7 +80,7 @@ async function createPackage(config, content, apiConfig) {
|
|
|
80
80
|
return result.pluginpackageid;
|
|
81
81
|
}
|
|
82
82
|
async function updatePackage(id, config, content, apiConfig) {
|
|
83
|
-
logger_1.logger.info(`update
|
|
83
|
+
logger_1.logger.info(`update package ${config.name}`);
|
|
84
84
|
const assembly = {
|
|
85
85
|
content: content,
|
|
86
86
|
version: config.version
|
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) {
|
package/license
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dataverse-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Utilities for interacting with Dataverse environments",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@azure/msal-node": "^1.12.0",
|
|
24
24
|
"commander": "^8.3.0",
|
|
25
25
|
"cryptr": "^6.0.3",
|
|
26
|
-
"dataverse-webapi": "^2.
|
|
26
|
+
"dataverse-webapi": "^2.2.0",
|
|
27
27
|
"envinfo": "^7.8.1",
|
|
28
28
|
"figures": "^3.2.0",
|
|
29
29
|
"glob": "^7.2.0",
|