dataverse-utils 2.0.2 → 2.0.6
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/assemblyDeploy.js +1 -1
- package/lib/auth.js +1 -1
- package/lib/cachePlugin.js +22 -7
- package/lib/dataverse-utils.js +2 -2
- package/lib/dataverse.service.js +4 -4
- package/lib/deploy.js +6 -6
- package/lib/generate.js +7 -7
- package/lib/models/pluginAssembly.js +11 -5
- package/lib/models/pluginImage.js +9 -3
- package/lib/models/pluginStep.js +18 -12
- package/lib/models/pluginType.js +10 -4
- package/lib/models/webResource.js +11 -5
- package/lib/webResourceDeploy.js +1 -1
- package/package.json +5 -7
- package/CHANGELOG.json +0 -65
- package/CHANGELOG.md +0 -37
package/lib/assemblyDeploy.js
CHANGED
|
@@ -18,7 +18,7 @@ async function deployAssembly(creds, apiConfig) {
|
|
|
18
18
|
const config = JSON.parse(configFile);
|
|
19
19
|
just_scripts_utils_1.logger.info('deploy assembly');
|
|
20
20
|
try {
|
|
21
|
-
await pluginAssembly_1.deploy(config, apiConfig, creds.solution);
|
|
21
|
+
await (0, pluginAssembly_1.deploy)(config, apiConfig, creds.solution);
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
24
|
just_scripts_utils_1.logger.error(error.message);
|
package/lib/auth.js
CHANGED
|
@@ -12,7 +12,7 @@ const getAccessToken = async (tenant, url) => {
|
|
|
12
12
|
authority: `https://login.microsoftonline.com/${tenant}/`
|
|
13
13
|
},
|
|
14
14
|
cache: {
|
|
15
|
-
cachePlugin: cachePlugin_1.cachePlugin(url.replace('https://', '').split('.')[0])
|
|
15
|
+
cachePlugin: (0, cachePlugin_1.cachePlugin)(url.replace('https://', '').split('.')[0])
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
const pca = new msal_node_1.PublicClientApplication(config);
|
package/lib/cachePlugin.js
CHANGED
|
@@ -7,6 +7,19 @@ exports.cachePlugin = void 0;
|
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const cryptr_1 = __importDefault(require("cryptr"));
|
|
11
|
+
const encrypt = (text) => {
|
|
12
|
+
const user = os_1.default.userInfo().username;
|
|
13
|
+
const cryptr = new cryptr_1.default(user);
|
|
14
|
+
const encrypted = cryptr.encrypt(text);
|
|
15
|
+
return encrypted;
|
|
16
|
+
};
|
|
17
|
+
const decrypt = (text) => {
|
|
18
|
+
const user = os_1.default.userInfo().username;
|
|
19
|
+
const cryptr = new cryptr_1.default(user);
|
|
20
|
+
const decrypted = cryptr.decrypt(text);
|
|
21
|
+
return decrypted;
|
|
22
|
+
};
|
|
10
23
|
function cachePlugin(org) {
|
|
11
24
|
const getCachePath = () => {
|
|
12
25
|
if (!fs_1.default.existsSync(path_1.default.join(os_1.default.homedir(), './.dataverse-utils/'))) {
|
|
@@ -23,18 +36,21 @@ function cachePlugin(org) {
|
|
|
23
36
|
reject();
|
|
24
37
|
}
|
|
25
38
|
else {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
tokenCacheContext.tokenCache.deserialize(data);
|
|
39
|
+
const decrypted = decrypt(data);
|
|
40
|
+
tokenCacheContext.tokenCache.deserialize(decrypted);
|
|
29
41
|
resolve();
|
|
30
42
|
}
|
|
31
43
|
});
|
|
32
44
|
}
|
|
33
45
|
else {
|
|
34
|
-
|
|
46
|
+
const encrypted = encrypt(tokenCacheContext.tokenCache.serialize());
|
|
47
|
+
fs_1.default.writeFile(cacheLocation, encrypted, (err) => {
|
|
35
48
|
if (err) {
|
|
36
49
|
reject();
|
|
37
50
|
}
|
|
51
|
+
else {
|
|
52
|
+
resolve();
|
|
53
|
+
}
|
|
38
54
|
});
|
|
39
55
|
}
|
|
40
56
|
});
|
|
@@ -42,9 +58,8 @@ function cachePlugin(org) {
|
|
|
42
58
|
const afterCacheAccess = (tokenCacheContext) => {
|
|
43
59
|
return new Promise((resolve, reject) => {
|
|
44
60
|
if (tokenCacheContext.cacheHasChanged) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
fs_1.default.writeFile(cacheLocation, tokenCacheContext.tokenCache.serialize(), (err) => {
|
|
61
|
+
const encrypted = encrypt(tokenCacheContext.tokenCache.serialize());
|
|
62
|
+
fs_1.default.writeFile(cacheLocation, encrypted, (err) => {
|
|
48
63
|
if (err) {
|
|
49
64
|
reject(err);
|
|
50
65
|
}
|
package/lib/dataverse-utils.js
CHANGED
|
@@ -18,7 +18,7 @@ commander_1.program
|
|
|
18
18
|
.argument('[type]', 'Type of project to deploy')
|
|
19
19
|
.argument('[files]', 'Comma separate list of files to deploy')
|
|
20
20
|
.action((type, files) => {
|
|
21
|
-
deploy_1.default(type, files);
|
|
21
|
+
(0, deploy_1.default)(type, files);
|
|
22
22
|
});
|
|
23
23
|
// Generate command
|
|
24
24
|
commander_1.program
|
|
@@ -26,7 +26,7 @@ commander_1.program
|
|
|
26
26
|
.description('Generate early-bound TypeScript file for specified table')
|
|
27
27
|
.argument('[table]', 'Table to generate')
|
|
28
28
|
.action((table) => {
|
|
29
|
-
generate_1.default(table);
|
|
29
|
+
(0, generate_1.default)(table);
|
|
30
30
|
});
|
|
31
31
|
// Show help on unknown command
|
|
32
32
|
commander_1.program
|
package/lib/dataverse.service.js
CHANGED
|
@@ -18,14 +18,14 @@ async function addToSolution(id, solution, type, apiConfig) {
|
|
|
18
18
|
AddRequiredComponents: false,
|
|
19
19
|
IncludedComponentSettingsValues: null
|
|
20
20
|
};
|
|
21
|
-
await node_1.unboundAction(apiConfig, 'AddSolutionComponent', data);
|
|
21
|
+
await (0, node_1.unboundAction)(apiConfig, 'AddSolutionComponent', data);
|
|
22
22
|
}
|
|
23
23
|
exports.addToSolution = addToSolution;
|
|
24
24
|
async function publish(publishXml, apiConfig) {
|
|
25
25
|
const data = {
|
|
26
26
|
ParameterXml: `<importexportxml><webresources>${publishXml}</webresources></importexportxml>`
|
|
27
27
|
};
|
|
28
|
-
await node_1.unboundAction(apiConfig, 'PublishXml', data);
|
|
28
|
+
await (0, node_1.unboundAction)(apiConfig, 'PublishXml', data);
|
|
29
29
|
}
|
|
30
30
|
exports.publish = publish;
|
|
31
31
|
async function getTableMetadata(table, apiConfig) {
|
|
@@ -33,7 +33,7 @@ async function getTableMetadata(table, apiConfig) {
|
|
|
33
33
|
'?$select=DisplayName,LogicalName,EntitySetName,SchemaName',
|
|
34
34
|
'&$expand=Attributes($select=LogicalName,SchemaName)'
|
|
35
35
|
].join('');
|
|
36
|
-
const metadata = await node_1.retrieveMultiple(apiConfig, `EntityDefinitions(LogicalName='${table}')`, options);
|
|
36
|
+
const metadata = await (0, node_1.retrieveMultiple)(apiConfig, `EntityDefinitions(LogicalName='${table}')`, options);
|
|
37
37
|
if (metadata == null) {
|
|
38
38
|
throw Error(`Table ${table} not found in metadata cache`);
|
|
39
39
|
}
|
|
@@ -41,7 +41,7 @@ async function getTableMetadata(table, apiConfig) {
|
|
|
41
41
|
'?$select=attributevalue,value,attributename',
|
|
42
42
|
`&$filter=objecttypecode eq '${table}'`
|
|
43
43
|
].join('');
|
|
44
|
-
const choiceMetadata = await node_1.retrieveMultiple(apiConfig, 'stringmaps', choiceOptions);
|
|
44
|
+
const choiceMetadata = await (0, node_1.retrieveMultiple)(apiConfig, 'stringmaps', choiceOptions);
|
|
45
45
|
const tableMetadata = {
|
|
46
46
|
logicalName: metadata.LogicalName,
|
|
47
47
|
schemaName: metadata.SchemaName,
|
package/lib/deploy.js
CHANGED
|
@@ -15,7 +15,7 @@ async function deploy(type, files) {
|
|
|
15
15
|
if (!type || (type !== 'webresource' && type !== 'assembly')) {
|
|
16
16
|
const invalid = type !== undefined && type !== 'webresource' && type !== 'assembly';
|
|
17
17
|
const invalidMessage = invalid ? `${type} is not a valid project type.` : '';
|
|
18
|
-
const { typePrompt } = await prompts_1.default({
|
|
18
|
+
const { typePrompt } = await (0, prompts_1.default)({
|
|
19
19
|
type: 'select',
|
|
20
20
|
name: 'typePrompt',
|
|
21
21
|
message: `${invalidMessage} select project type to deploy`,
|
|
@@ -35,10 +35,10 @@ async function deploy(type, files) {
|
|
|
35
35
|
const creds = JSON.parse(credsFile).connection;
|
|
36
36
|
let token = null;
|
|
37
37
|
try {
|
|
38
|
-
token = await auth_1.getAccessToken(creds.tenant, creds.server);
|
|
38
|
+
token = await (0, auth_1.getAccessToken)(creds.tenant, creds.server);
|
|
39
39
|
}
|
|
40
|
-
catch (
|
|
41
|
-
just_scripts_utils_1.logger.error(`failed to acquire access token: ${
|
|
40
|
+
catch (error) {
|
|
41
|
+
just_scripts_utils_1.logger.error(`failed to acquire access token: ${error.message}`);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
if (token == null || token.accessToken == null) {
|
|
@@ -48,10 +48,10 @@ async function deploy(type, files) {
|
|
|
48
48
|
const apiConfig = new node_1.WebApiConfig('8.2', token.accessToken, creds.server);
|
|
49
49
|
switch (type) {
|
|
50
50
|
case 'webresource':
|
|
51
|
-
await webResourceDeploy_1.deployWebResource(creds, apiConfig, files);
|
|
51
|
+
await (0, webResourceDeploy_1.deployWebResource)(creds, apiConfig, files);
|
|
52
52
|
break;
|
|
53
53
|
case 'assembly':
|
|
54
|
-
await assemblyDeploy_1.deployAssembly(creds, apiConfig);
|
|
54
|
+
await (0, assemblyDeploy_1.deployAssembly)(creds, apiConfig);
|
|
55
55
|
break;
|
|
56
56
|
default:
|
|
57
57
|
break;
|
package/lib/generate.js
CHANGED
|
@@ -11,11 +11,11 @@ const dataverse_service_1 = require("./dataverse.service");
|
|
|
11
11
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
12
12
|
const auth_1 = require("./auth");
|
|
13
13
|
async function generate(table) {
|
|
14
|
-
|
|
15
|
-
const { tablePrompt } = await prompts_1.default({
|
|
14
|
+
while (!table) {
|
|
15
|
+
const { tablePrompt } = await (0, prompts_1.default)({
|
|
16
16
|
type: 'text',
|
|
17
17
|
name: 'tablePrompt',
|
|
18
|
-
message: `
|
|
18
|
+
message: `enter table to generate`
|
|
19
19
|
});
|
|
20
20
|
table = tablePrompt;
|
|
21
21
|
}
|
|
@@ -28,10 +28,10 @@ async function generate(table) {
|
|
|
28
28
|
const creds = JSON.parse(credsFile).connection;
|
|
29
29
|
let token = null;
|
|
30
30
|
try {
|
|
31
|
-
token = await auth_1.getAccessToken(creds.tenant, creds.server);
|
|
31
|
+
token = await (0, auth_1.getAccessToken)(creds.tenant, creds.server);
|
|
32
32
|
}
|
|
33
|
-
catch (
|
|
34
|
-
just_scripts_utils_1.logger.error(`failed to acquire access token: ${
|
|
33
|
+
catch (error) {
|
|
34
|
+
just_scripts_utils_1.logger.error(`failed to acquire access token: ${error.message}`);
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
if (token == null || token.accessToken == null) {
|
|
@@ -42,7 +42,7 @@ async function generate(table) {
|
|
|
42
42
|
let metadata = {};
|
|
43
43
|
just_scripts_utils_1.logger.info('Retrieve table metadata');
|
|
44
44
|
try {
|
|
45
|
-
metadata = await dataverse_service_1.getTableMetadata(table, apiConfig);
|
|
45
|
+
metadata = await (0, dataverse_service_1.getTableMetadata)(table, apiConfig);
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
48
48
|
just_scripts_utils_1.logger.error(error.message);
|
|
@@ -42,7 +42,7 @@ async function deploy(config, apiConfig, solution) {
|
|
|
42
42
|
}
|
|
43
43
|
if (solution != undefined) {
|
|
44
44
|
try {
|
|
45
|
-
await dataverse_service_1.addToSolution(assemblyId, solution, dataverse_service_1.ComponentType.PluginAssembly, apiConfig);
|
|
45
|
+
await (0, dataverse_service_1.addToSolution)(assemblyId, solution, dataverse_service_1.ComponentType.PluginAssembly, apiConfig);
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
48
48
|
just_scripts_utils_1.logger.error(`failed to add to solution: ${error.message}`);
|
|
@@ -53,7 +53,7 @@ async function deploy(config, apiConfig, solution) {
|
|
|
53
53
|
try {
|
|
54
54
|
const promises = config.types.map(async (type) => {
|
|
55
55
|
type['pluginassemblyid@odata.bind'] = `/pluginassemblies(${assemblyId})`;
|
|
56
|
-
await pluginType_1.deployType(type, apiConfig, solution);
|
|
56
|
+
await (0, pluginType_1.deployType)(type, apiConfig, solution);
|
|
57
57
|
});
|
|
58
58
|
await Promise.all(promises);
|
|
59
59
|
}
|
|
@@ -66,7 +66,7 @@ async function deploy(config, apiConfig, solution) {
|
|
|
66
66
|
exports.deploy = deploy;
|
|
67
67
|
async function retrieveAssembly(name, apiConfig) {
|
|
68
68
|
const options = `$select=pluginassemblyid&$filter=name eq '${name}'`;
|
|
69
|
-
const result = await node_1.retrieveMultiple(apiConfig, 'pluginassemblies', options);
|
|
69
|
+
const result = await (0, node_1.retrieveMultiple)(apiConfig, 'pluginassemblies', options);
|
|
70
70
|
return result.value.length > 0 ? result.value[0].pluginassemblyid : '';
|
|
71
71
|
}
|
|
72
72
|
async function createAssembly(config, content, apiConfig) {
|
|
@@ -80,7 +80,13 @@ async function createAssembly(config, content, apiConfig) {
|
|
|
80
80
|
sourcetype: 0,
|
|
81
81
|
culture: ''
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
let result;
|
|
84
|
+
try {
|
|
85
|
+
result = await (0, node_1.createWithReturnData)(apiConfig, 'pluginassemblies', assembly, '$select=pluginassemblyid');
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
throw new Error(error.message);
|
|
89
|
+
}
|
|
84
90
|
return result.pluginassemblyid;
|
|
85
91
|
}
|
|
86
92
|
async function updateAssembly(id, config, content, apiConfig) {
|
|
@@ -89,5 +95,5 @@ async function updateAssembly(id, config, content, apiConfig) {
|
|
|
89
95
|
content: content,
|
|
90
96
|
version: config.version
|
|
91
97
|
};
|
|
92
|
-
return node_1.update(apiConfig, 'pluginassemblies', id, assembly);
|
|
98
|
+
return (0, node_1.update)(apiConfig, 'pluginassemblies', id, assembly);
|
|
93
99
|
}
|
|
@@ -44,15 +44,21 @@ async function deployImage(stepId, image, message, apiConfig) {
|
|
|
44
44
|
exports.deployImage = deployImage;
|
|
45
45
|
async function retrieveImage(stepId, image, apiConfig) {
|
|
46
46
|
const options = `$select=sdkmessageprocessingstepimageid&$filter=name eq '${image.name}' and _sdkmessageprocessingstepid_value eq ${stepId}`;
|
|
47
|
-
const result = await node_1.retrieveMultiple(apiConfig, 'sdkmessageprocessingstepimages', options);
|
|
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
50
|
async function createImage(image, apiConfig) {
|
|
51
51
|
just_scripts_utils_1.logger.info(`create plugin image ${image.name}`);
|
|
52
|
-
|
|
52
|
+
let result;
|
|
53
|
+
try {
|
|
54
|
+
result = await (0, node_1.createWithReturnData)(apiConfig, 'sdkmessageprocessingstepimages', image, '$select=sdkmessageprocessingstepimageid');
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throw new Error(error.message);
|
|
58
|
+
}
|
|
53
59
|
return result.sdkmessageprocessingstepimageid;
|
|
54
60
|
}
|
|
55
61
|
async function updateImage(id, image, apiConfig) {
|
|
56
62
|
just_scripts_utils_1.logger.info(`update plugin image ${image.name}`);
|
|
57
|
-
return node_1.update(apiConfig, 'sdkmessageprocessingstepimages', id, image);
|
|
63
|
+
return (0, node_1.update)(apiConfig, 'sdkmessageprocessingstepimages', id, image);
|
|
58
64
|
}
|
package/lib/models/pluginStep.js
CHANGED
|
@@ -9,12 +9,12 @@ async function deployStep(step, apiConfig, solution) {
|
|
|
9
9
|
var _a, _b;
|
|
10
10
|
let stepId = await retrieveStep(step.name, apiConfig);
|
|
11
11
|
const messageId = await getSdkMessageId((_a = step.message) !== null && _a !== void 0 ? _a : '', apiConfig);
|
|
12
|
-
if (messageId ==
|
|
12
|
+
if (messageId == '') {
|
|
13
13
|
just_scripts_utils_1.logger.error(`sdk message ${step.message} not found`);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
const filterId = await getSdkMessageFilterId(messageId, (_b = step.entity) !== null && _b !== void 0 ? _b : '', apiConfig);
|
|
17
|
-
if (filterId ==
|
|
17
|
+
if (filterId == '') {
|
|
18
18
|
just_scripts_utils_1.logger.error(`sdk message ${step.message} for entity ${step.entity} not found`);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
@@ -45,16 +45,16 @@ async function deployStep(step, apiConfig, solution) {
|
|
|
45
45
|
}
|
|
46
46
|
if (solution != undefined) {
|
|
47
47
|
try {
|
|
48
|
-
await dataverse_service_1.addToSolution(stepId, solution, dataverse_service_1.ComponentType.SDKMessageProcessingStep, apiConfig);
|
|
48
|
+
await (0, dataverse_service_1.addToSolution)(stepId, solution, dataverse_service_1.ComponentType.SDKMessageProcessingStep, apiConfig);
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
51
|
throw new Error(`failed to add to solution: ${error.message}`);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
if (images) {
|
|
55
|
+
if (images && images.length > 0) {
|
|
56
56
|
try {
|
|
57
|
-
const promises = images.map(image => pluginImage_1.deployImage(stepId, image, message, apiConfig));
|
|
57
|
+
const promises = images.map(image => (0, pluginImage_1.deployImage)(stepId, image, message, apiConfig));
|
|
58
58
|
await Promise.all(promises);
|
|
59
59
|
}
|
|
60
60
|
catch (error) {
|
|
@@ -66,7 +66,7 @@ async function deployStep(step, apiConfig, solution) {
|
|
|
66
66
|
exports.deployStep = deployStep;
|
|
67
67
|
async function retrieveStep(name, apiConfig) {
|
|
68
68
|
const options = `$select=sdkmessageprocessingstepid&$filter=name eq '${name}'`;
|
|
69
|
-
const result = await node_1.retrieveMultiple(apiConfig, 'sdkmessageprocessingsteps', options);
|
|
69
|
+
const result = await (0, node_1.retrieveMultiple)(apiConfig, 'sdkmessageprocessingsteps', options);
|
|
70
70
|
return result.value.length > 0 ? result.value[0].sdkmessageprocessingstepid : '';
|
|
71
71
|
}
|
|
72
72
|
async function getSdkMessageFilterId(messageId, entityName, apiConfig) {
|
|
@@ -74,23 +74,29 @@ async function getSdkMessageFilterId(messageId, entityName, apiConfig) {
|
|
|
74
74
|
`?$filter=primaryobjecttypecode eq '${entityName}' and _sdkmessageid_value eq ${messageId}`,
|
|
75
75
|
'&$select=sdkmessagefilterid'
|
|
76
76
|
].join('');
|
|
77
|
-
const message = await node_1.retrieveMultiple(apiConfig, 'sdkmessagefilters', options);
|
|
78
|
-
return message.value[0].sdkmessagefilterid;
|
|
77
|
+
const message = await (0, node_1.retrieveMultiple)(apiConfig, 'sdkmessagefilters', options);
|
|
78
|
+
return message.value.length > 0 ? message.value[0].sdkmessagefilterid : '';
|
|
79
79
|
}
|
|
80
80
|
async function getSdkMessageId(name, apiConfig) {
|
|
81
81
|
const options = [
|
|
82
82
|
`?$filter=name eq '${name}'`,
|
|
83
83
|
'&$select=sdkmessageid'
|
|
84
84
|
].join('');
|
|
85
|
-
const message = await node_1.retrieveMultiple(apiConfig, 'sdkmessages', options);
|
|
86
|
-
return message.value[0].sdkmessageid;
|
|
85
|
+
const message = await (0, node_1.retrieveMultiple)(apiConfig, 'sdkmessages', options);
|
|
86
|
+
return message.value.length > 0 ? message.value[0].sdkmessageid : '';
|
|
87
87
|
}
|
|
88
88
|
async function createStep(step, apiConfig) {
|
|
89
89
|
just_scripts_utils_1.logger.info(`create plugin step ${step.name}`);
|
|
90
|
-
|
|
90
|
+
let result;
|
|
91
|
+
try {
|
|
92
|
+
result = await (0, node_1.createWithReturnData)(apiConfig, 'sdkmessageprocessingsteps', step, '$select=sdkmessageprocessingstepid');
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
throw new Error(error.message);
|
|
96
|
+
}
|
|
91
97
|
return result.sdkmessageprocessingstepid;
|
|
92
98
|
}
|
|
93
99
|
async function updateStep(id, step, apiConfig) {
|
|
94
100
|
just_scripts_utils_1.logger.info(`update plugin step ${step.name}`);
|
|
95
|
-
return node_1.update(apiConfig, 'sdkmessageprocessingsteps', id, step);
|
|
101
|
+
return (0, node_1.update)(apiConfig, 'sdkmessageprocessingsteps', id, step);
|
|
96
102
|
}
|
package/lib/models/pluginType.js
CHANGED
|
@@ -33,7 +33,7 @@ async function deployType(type, apiConfig, solution) {
|
|
|
33
33
|
if (type.steps) {
|
|
34
34
|
const promises = type.steps.map(async (step) => {
|
|
35
35
|
step['plugintypeid@odata.bind'] = `/plugintypes(${typeId})`;
|
|
36
|
-
await pluginStep_1.deployStep(step, apiConfig, solution);
|
|
36
|
+
await (0, pluginStep_1.deployStep)(step, apiConfig, solution);
|
|
37
37
|
});
|
|
38
38
|
await Promise.all(promises);
|
|
39
39
|
}
|
|
@@ -46,15 +46,21 @@ async function deployType(type, apiConfig, solution) {
|
|
|
46
46
|
exports.deployType = deployType;
|
|
47
47
|
async function retrieveType(name, apiConfig) {
|
|
48
48
|
const options = `$select=plugintypeid&$filter=typename eq '${name}'`;
|
|
49
|
-
const result = await node_1.retrieveMultiple(apiConfig, 'plugintypes', options);
|
|
49
|
+
const result = await (0, node_1.retrieveMultiple)(apiConfig, 'plugintypes', options);
|
|
50
50
|
return result.value.length > 0 ? result.value[0].plugintypeid : '';
|
|
51
51
|
}
|
|
52
52
|
async function createType(type, apiConfig) {
|
|
53
53
|
just_scripts_utils_1.logger.info(`create assembly type ${type.name}`);
|
|
54
|
-
|
|
54
|
+
let result;
|
|
55
|
+
try {
|
|
56
|
+
result = await (0, node_1.createWithReturnData)(apiConfig, 'plugintypes', type, '$select=plugintypeid');
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
throw new Error(error.message);
|
|
60
|
+
}
|
|
55
61
|
return result.plugintypeid;
|
|
56
62
|
}
|
|
57
63
|
async function updateType(id, type, apiConfig) {
|
|
58
64
|
just_scripts_utils_1.logger.info(`update assembly type ${type.name}`);
|
|
59
|
-
return node_1.update(apiConfig, 'plugintypes', id, type);
|
|
65
|
+
return (0, node_1.update)(apiConfig, 'plugintypes', id, type);
|
|
60
66
|
}
|
|
@@ -82,7 +82,7 @@ async function deploy(webResources, apiConfig, solution, files) {
|
|
|
82
82
|
}
|
|
83
83
|
if (solution != undefined) {
|
|
84
84
|
try {
|
|
85
|
-
await dataverse_service_1.addToSolution(resourceId, solution, dataverse_service_1.ComponentType.WebResource, apiConfig);
|
|
85
|
+
await (0, dataverse_service_1.addToSolution)(resourceId, solution, dataverse_service_1.ComponentType.WebResource, apiConfig);
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
88
88
|
just_scripts_utils_1.logger.error(`failed to add to solution: ${error.message}`);
|
|
@@ -94,7 +94,7 @@ async function deploy(webResources, apiConfig, solution, files) {
|
|
|
94
94
|
// publish resources
|
|
95
95
|
if (publishXml.length > 0) {
|
|
96
96
|
try {
|
|
97
|
-
await dataverse_service_1.publish(publishXml.join(''), apiConfig);
|
|
97
|
+
await (0, dataverse_service_1.publish)(publishXml.join(''), apiConfig);
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
100
100
|
just_scripts_utils_1.logger.error(error.message);
|
|
@@ -104,7 +104,7 @@ async function deploy(webResources, apiConfig, solution, files) {
|
|
|
104
104
|
exports.deploy = deploy;
|
|
105
105
|
async function retrieveResource(name, apiConfig) {
|
|
106
106
|
const options = `$select=webresourceid&$filter=name eq '${name}'`;
|
|
107
|
-
const result = await node_1.retrieveMultiple(apiConfig, 'webresourceset', options);
|
|
107
|
+
const result = await (0, node_1.retrieveMultiple)(apiConfig, 'webresourceset', options);
|
|
108
108
|
return result.value.length > 0 ? result.value[0].webresourceid : '';
|
|
109
109
|
}
|
|
110
110
|
async function createResource(resource, content, apiConfig) {
|
|
@@ -115,7 +115,13 @@ async function createResource(resource, content, apiConfig) {
|
|
|
115
115
|
displayname: resource.displayname || resource.name,
|
|
116
116
|
content: content
|
|
117
117
|
};
|
|
118
|
-
|
|
118
|
+
let result;
|
|
119
|
+
try {
|
|
120
|
+
result = await (0, node_1.createWithReturnData)(apiConfig, 'webresourceset', webResource, '$select=webresourceid');
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
throw new Error(error.message);
|
|
124
|
+
}
|
|
119
125
|
return result.webresourceid;
|
|
120
126
|
}
|
|
121
127
|
async function updateResource(id, resource, content, apiConfig) {
|
|
@@ -123,6 +129,6 @@ async function updateResource(id, resource, content, apiConfig) {
|
|
|
123
129
|
const webResource = {
|
|
124
130
|
content: content
|
|
125
131
|
};
|
|
126
|
-
await node_1.update(apiConfig, 'webresourceset', id, webResource);
|
|
132
|
+
await (0, node_1.update)(apiConfig, 'webresourceset', id, webResource);
|
|
127
133
|
return `<webresource>{${id}}</webresource>`;
|
|
128
134
|
}
|
package/lib/webResourceDeploy.js
CHANGED
|
@@ -18,7 +18,7 @@ async function deployWebResource(creds, apiConfig, files) {
|
|
|
18
18
|
const config = JSON.parse(configFile).webResources;
|
|
19
19
|
just_scripts_utils_1.logger.info('deploy web resources');
|
|
20
20
|
try {
|
|
21
|
-
await webResource_1.deploy(config, apiConfig, creds.solution, files);
|
|
21
|
+
await (0, webResource_1.deploy)(config, apiConfig, creds.solution, files);
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
24
|
just_scripts_utils_1.logger.error(error.message);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dataverse-utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -19,17 +19,15 @@
|
|
|
19
19
|
"prebuild": "rimraf lib"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"envinfo": "^7.8.1",
|
|
23
22
|
"@azure/msal-node": "^1.3.1",
|
|
24
|
-
"prompts": "^2.4.1",
|
|
25
|
-
"dataverse-webapi": "^2.0.0",
|
|
26
23
|
"commander": "^8.2.0",
|
|
27
|
-
"just-scripts-utils": "^1.1.4",
|
|
28
24
|
"cryptr": "^6.0.2",
|
|
29
|
-
"
|
|
25
|
+
"dataverse-webapi": "^2.0.1",
|
|
26
|
+
"envinfo": "^7.8.1",
|
|
27
|
+
"just-scripts-utils": "^1.1.4",
|
|
28
|
+
"prompts": "^2.4.1"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@types/cryptr": "^4.0.1",
|
|
33
31
|
"@types/node": "^16.9.1",
|
|
34
32
|
"@types/prompts": "^2.0.14"
|
|
35
33
|
}
|
package/CHANGELOG.json
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dataverse-utils",
|
|
3
|
-
"entries": [
|
|
4
|
-
{
|
|
5
|
-
"date": "Thu, 16 Sep 2021 21:29:55 GMT",
|
|
6
|
-
"tag": "dataverse-utils_v2.0.2",
|
|
7
|
-
"version": "2.0.2",
|
|
8
|
-
"comments": {
|
|
9
|
-
"patch": [
|
|
10
|
-
{
|
|
11
|
-
"comment": "Fix first time auth",
|
|
12
|
-
"author": "derek.finlinson@journeyteam.com",
|
|
13
|
-
"commit": "d13f2f05e702a82bb127dbac7f9f33daf027ea64",
|
|
14
|
-
"package": "dataverse-utils"
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"date": "Thu, 16 Sep 2021 20:57:31 GMT",
|
|
21
|
-
"tag": "dataverse-utils_v2.0.1",
|
|
22
|
-
"version": "2.0.1",
|
|
23
|
-
"comments": {
|
|
24
|
-
"patch": [
|
|
25
|
-
{
|
|
26
|
-
"comment": "Update wording for entering table",
|
|
27
|
-
"author": "derek.finlinson@journeyteam.com",
|
|
28
|
-
"commit": "963c071a39980f4cef59a3ab24c1f749504d0584",
|
|
29
|
-
"package": "dataverse-utils"
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"date": "Thu, 16 Sep 2021 20:49:48 GMT",
|
|
36
|
-
"tag": "dataverse-utils_v2.0.0",
|
|
37
|
-
"version": "2.0.0",
|
|
38
|
-
"comments": {
|
|
39
|
-
"major": [
|
|
40
|
-
{
|
|
41
|
-
"comment": "Switch to device-code auth",
|
|
42
|
-
"author": "derek.finlinson@journeyteam.com",
|
|
43
|
-
"commit": "b1c526bdddb59fe2f4a3eb61096909ebbb2379d7",
|
|
44
|
-
"package": "dataverse-utils"
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"date": "Thu, 02 Sep 2021 16:22:00 GMT",
|
|
51
|
-
"tag": "dataverse-utils_v1.0.1",
|
|
52
|
-
"version": "1.0.1",
|
|
53
|
-
"comments": {
|
|
54
|
-
"patch": [
|
|
55
|
-
{
|
|
56
|
-
"comment": "Add generate command; Rename project",
|
|
57
|
-
"author": "derek.finlinson@journeyteam.com",
|
|
58
|
-
"commit": "d1c26f12e1e58b86cc3cfe26274f0dbd35d5ad70",
|
|
59
|
-
"package": "dataverse-utils"
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Change Log - dataverse-utils
|
|
2
|
-
|
|
3
|
-
This log was last generated on Thu, 16 Sep 2021 21:29:55 GMT and should not be manually modified.
|
|
4
|
-
|
|
5
|
-
<!-- Start content -->
|
|
6
|
-
|
|
7
|
-
## 2.0.2
|
|
8
|
-
|
|
9
|
-
Thu, 16 Sep 2021 21:29:55 GMT
|
|
10
|
-
|
|
11
|
-
### Patches
|
|
12
|
-
|
|
13
|
-
- Fix first time auth (derek.finlinson@journeyteam.com)
|
|
14
|
-
|
|
15
|
-
## 2.0.1
|
|
16
|
-
|
|
17
|
-
Thu, 16 Sep 2021 20:57:31 GMT
|
|
18
|
-
|
|
19
|
-
### Patches
|
|
20
|
-
|
|
21
|
-
- Update wording for entering table (derek.finlinson@journeyteam.com)
|
|
22
|
-
|
|
23
|
-
## 2.0.0
|
|
24
|
-
|
|
25
|
-
Thu, 16 Sep 2021 20:49:48 GMT
|
|
26
|
-
|
|
27
|
-
### Major changes
|
|
28
|
-
|
|
29
|
-
- Switch to device-code auth (derek.finlinson@journeyteam.com)
|
|
30
|
-
|
|
31
|
-
## 1.0.1
|
|
32
|
-
|
|
33
|
-
Thu, 02 Sep 2021 16:22:00 GMT
|
|
34
|
-
|
|
35
|
-
### Patches
|
|
36
|
-
|
|
37
|
-
- Add generate command; Rename project (derek.finlinson@journeyteam.com)
|