dataverse-utils 2.0.5 → 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.
@@ -8,7 +8,6 @@ const os_1 = __importDefault(require("os"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const cryptr_1 = __importDefault(require("cryptr"));
11
- const algorithm = 'aes-256-ctr';
12
11
  const encrypt = (text) => {
13
12
  const user = os_1.default.userInfo().username;
14
13
  const cryptr = new cryptr_1.default(user);
@@ -80,7 +80,13 @@ async function createAssembly(config, content, apiConfig) {
80
80
  sourcetype: 0,
81
81
  culture: ''
82
82
  };
83
- const result = await (0, node_1.createWithReturnData)(apiConfig, 'pluginassemblies', assembly, '$select=pluginassemblyid');
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) {
@@ -49,7 +49,13 @@ async function retrieveImage(stepId, image, apiConfig) {
49
49
  }
50
50
  async function createImage(image, apiConfig) {
51
51
  just_scripts_utils_1.logger.info(`create plugin image ${image.name}`);
52
- const result = await (0, node_1.createWithReturnData)(apiConfig, 'sdkmessageprocessingstepimages', image, '$select=sdkmessageprocessingstepimageid');
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) {
@@ -52,7 +52,7 @@ async function deployStep(step, apiConfig, solution) {
52
52
  }
53
53
  }
54
54
  }
55
- if (images) {
55
+ if (images && images.length > 0) {
56
56
  try {
57
57
  const promises = images.map(image => (0, pluginImage_1.deployImage)(stepId, image, message, apiConfig));
58
58
  await Promise.all(promises);
@@ -87,7 +87,13 @@ async function getSdkMessageId(name, apiConfig) {
87
87
  }
88
88
  async function createStep(step, apiConfig) {
89
89
  just_scripts_utils_1.logger.info(`create plugin step ${step.name}`);
90
- const result = await (0, node_1.createWithReturnData)(apiConfig, 'sdkmessageprocessingsteps', step, '$select=sdkmessageprocessingstepid');
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) {
@@ -51,7 +51,13 @@ async function retrieveType(name, apiConfig) {
51
51
  }
52
52
  async function createType(type, apiConfig) {
53
53
  just_scripts_utils_1.logger.info(`create assembly type ${type.name}`);
54
- const result = await (0, node_1.createWithReturnData)(apiConfig, 'plugintypes', type, '$select=plugintypeid');
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) {
@@ -115,7 +115,13 @@ async function createResource(resource, content, apiConfig) {
115
115
  displayname: resource.displayname || resource.name,
116
116
  content: content
117
117
  };
118
- const result = await (0, node_1.createWithReturnData)(apiConfig, 'webresourceset', webResource, '$select=webresourceid');
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataverse-utils",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "bin": {