dataverse-utils 2.0.4 → 2.0.8

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);
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.deploy = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
- const glob_1 = __importDefault(require("glob"));
8
+ const node_glob_1 = __importDefault(require("node-glob"));
9
9
  const node_1 = require("dataverse-webapi/lib/node");
10
10
  const pluginType_1 = require("./pluginType");
11
11
  const dataverse_service_1 = require("../dataverse.service");
12
12
  const just_scripts_utils_1 = require("just-scripts-utils");
13
13
  async function deploy(config, apiConfig, solution) {
14
- const files = glob_1.default.sync(`**/${config.name}.dll`);
14
+ const files = node_glob_1.default.sync(`**/${config.name}.dll`);
15
15
  if (files.length === 0) {
16
16
  just_scripts_utils_1.logger.error(`assembly ${config.name}.dll not found`);
17
17
  return;
@@ -81,6 +81,9 @@ async function createAssembly(config, content, apiConfig) {
81
81
  culture: ''
82
82
  };
83
83
  const result = await (0, node_1.createWithReturnData)(apiConfig, 'pluginassemblies', assembly, '$select=pluginassemblyid');
84
+ if (result.error) {
85
+ throw new Error(result.error.message);
86
+ }
84
87
  return result.pluginassemblyid;
85
88
  }
86
89
  async function updateAssembly(id, config, content, apiConfig) {
@@ -50,6 +50,9 @@ async function retrieveImage(stepId, image, apiConfig) {
50
50
  async function createImage(image, apiConfig) {
51
51
  just_scripts_utils_1.logger.info(`create plugin image ${image.name}`);
52
52
  const result = await (0, node_1.createWithReturnData)(apiConfig, 'sdkmessageprocessingstepimages', image, '$select=sdkmessageprocessingstepimageid');
53
+ if (result.error) {
54
+ throw new Error(result.error.message);
55
+ }
53
56
  return result.sdkmessageprocessingstepimageid;
54
57
  }
55
58
  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);
@@ -88,6 +88,9 @@ async function getSdkMessageId(name, apiConfig) {
88
88
  async function createStep(step, apiConfig) {
89
89
  just_scripts_utils_1.logger.info(`create plugin step ${step.name}`);
90
90
  const result = await (0, node_1.createWithReturnData)(apiConfig, 'sdkmessageprocessingsteps', step, '$select=sdkmessageprocessingstepid');
91
+ if (result.error) {
92
+ throw new Error(result.error.message);
93
+ }
91
94
  return result.sdkmessageprocessingstepid;
92
95
  }
93
96
  async function updateStep(id, step, apiConfig) {
@@ -52,6 +52,9 @@ async function retrieveType(name, apiConfig) {
52
52
  async function createType(type, apiConfig) {
53
53
  just_scripts_utils_1.logger.info(`create assembly type ${type.name}`);
54
54
  const result = await (0, node_1.createWithReturnData)(apiConfig, 'plugintypes', type, '$select=plugintypeid');
55
+ if (result.error) {
56
+ throw new Error(result.error.message);
57
+ }
55
58
  return result.plugintypeid;
56
59
  }
57
60
  async function updateType(id, type, apiConfig) {
@@ -116,6 +116,9 @@ async function createResource(resource, content, apiConfig) {
116
116
  content: content
117
117
  };
118
118
  const result = await (0, node_1.createWithReturnData)(apiConfig, 'webresourceset', webResource, '$select=webresourceid');
119
+ if (result.error) {
120
+ throw new Error(result.error.message);
121
+ }
119
122
  return result.webresourceid;
120
123
  }
121
124
  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.4",
3
+ "version": "2.0.8",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -21,6 +21,7 @@
21
21
  "dependencies": {
22
22
  "@azure/msal-node": "^1.3.1",
23
23
  "commander": "^8.2.0",
24
+ "node-glob": "^1.2.0",
24
25
  "cryptr": "^6.0.2",
25
26
  "dataverse-webapi": "^2.0.1",
26
27
  "envinfo": "^7.8.1",
@@ -29,6 +30,7 @@
29
30
  },
30
31
  "devDependencies": {
31
32
  "@types/node": "^16.9.1",
33
+ "@types/glob": "^7.2.0",
32
34
  "@types/prompts": "^2.0.14"
33
35
  }
34
36
  }