dataverse-utils 2.6.10 → 2.6.11
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 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.deployAssembly = void 0;
|
|
6
|
+
exports.retrieveAssembly = exports.deployAssembly = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const glob_1 = __importDefault(require("glob"));
|
|
9
9
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
@@ -61,6 +61,7 @@ async function retrieveAssembly(name, apiConfig) {
|
|
|
61
61
|
const result = await (0, node_1.retrieveMultiple)(apiConfig, 'pluginassemblies', options);
|
|
62
62
|
return result.value.length > 0 ? result.value[0].pluginassemblyid : '';
|
|
63
63
|
}
|
|
64
|
+
exports.retrieveAssembly = retrieveAssembly;
|
|
64
65
|
async function createAssembly(config, content, apiConfig, solution) {
|
|
65
66
|
logger_1.logger.info(`create assembly ${config.name}`);
|
|
66
67
|
const assembly = {
|
|
@@ -9,6 +9,8 @@ const glob_1 = __importDefault(require("glob"));
|
|
|
9
9
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
10
10
|
const pluginAssembly_1 = require("./pluginAssembly");
|
|
11
11
|
const logger_1 = require("../logger");
|
|
12
|
+
const pluginType_1 = require("./pluginType");
|
|
13
|
+
const pluginStep_1 = require("./pluginStep");
|
|
12
14
|
async function deployPluginPackage(config, apiConfig, solution) {
|
|
13
15
|
const files = glob_1.default.sync(`**/${config.name}.*.nupkg`);
|
|
14
16
|
if (files.length === 0) {
|
|
@@ -40,18 +42,25 @@ async function deployPluginPackage(config, apiConfig, solution) {
|
|
|
40
42
|
throw new Error(`failed to create package: ${error.message}`);
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
|
-
let assemblyId;
|
|
44
45
|
if (config.assembly != null) {
|
|
45
46
|
try {
|
|
46
|
-
config.assembly
|
|
47
|
-
|
|
47
|
+
const assemblyId = await (0, pluginAssembly_1.retrieveAssembly)(config.assembly.name, apiConfig);
|
|
48
|
+
const promises = config.assembly.types?.map(async (t) => {
|
|
49
|
+
const typeId = await (0, pluginType_1.retrieveType)(t.typename, assemblyId, apiConfig);
|
|
50
|
+
const stepPromises = t.steps?.map((s) => {
|
|
51
|
+
s['plugintypeid@odata.bind'] = `/plugintypes(${typeId})`;
|
|
52
|
+
return (0, pluginStep_1.deployStep)(s, typeId, apiConfig, solution);
|
|
53
|
+
}) ?? [];
|
|
54
|
+
await Promise.all(stepPromises);
|
|
55
|
+
}) ?? [];
|
|
56
|
+
await Promise.all(promises);
|
|
48
57
|
}
|
|
49
58
|
catch (error) {
|
|
50
59
|
logger_1.logger.error(error.message);
|
|
51
60
|
return;
|
|
52
61
|
}
|
|
53
62
|
}
|
|
54
|
-
return
|
|
63
|
+
return packageId;
|
|
55
64
|
}
|
|
56
65
|
exports.deployPluginPackage = deployPluginPackage;
|
|
57
66
|
async function retrievePackage(prefix, name, apiConfig) {
|