dataverse-utils 2.1.1 → 2.2.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/CHANGELOG.json +67 -1
- package/CHANGELOG.md +38 -5
- package/lib/logger.js +22 -12
- package/lib/{assemblyDeploy.js → packages/dataverse-utils/src/assemblyDeploy.js} +2 -2
- package/lib/{auth.js → packages/dataverse-utils/src/auth.js} +2 -2
- package/lib/{cachePlugin.js → packages/dataverse-utils/src/cachePlugin.js} +28 -10
- package/lib/{dataverse.service.js → packages/dataverse-utils/src/dataverse.service.js} +0 -0
- package/lib/{deploy.js → packages/dataverse-utils/src/deploy.js} +22 -3
- package/lib/{generate.js → packages/dataverse-utils/src/generate.js} +2 -2
- package/lib/{index.js → packages/dataverse-utils/src/index.js} +0 -0
- package/lib/{models → packages/dataverse-utils/src/models}/pluginAssembly.js +3 -3
- package/lib/{models → packages/dataverse-utils/src/models}/pluginImage.js +1 -1
- package/lib/{models → packages/dataverse-utils/src/models}/pluginStep.js +7 -7
- package/lib/{models → packages/dataverse-utils/src/models}/pluginType.js +6 -6
- package/lib/{models → packages/dataverse-utils/src/models}/webResource.js +2 -2
- package/lib/{webResourceDeploy.js → packages/dataverse-utils/src/webResourceDeploy.js} +2 -2
- package/package.json +6 -5
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,73 @@
|
|
|
2
2
|
"name": "dataverse-utils",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 07 Feb 2022 22:01:58 GMT",
|
|
6
|
+
"tag": "dataverse-utils_v2.2.0",
|
|
7
|
+
"version": "2.2.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "derek.finlinson@journeyteam.com",
|
|
12
|
+
"package": "dataverse-utils",
|
|
13
|
+
"commit": "55d633b2c3064bbdce48c5d314d8e7572a015882",
|
|
14
|
+
"comment": "Switch to combined logger"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "dataverse-utils",
|
|
19
|
+
"comment": "Bump dataverse-webapi to v2.0.4",
|
|
20
|
+
"commit": "83b50fd1a35a0645f279e60b8ca0eb2ace5c0ad3"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Fri, 28 Jan 2022 23:11:16 GMT",
|
|
27
|
+
"tag": "dataverse-utils_v2.1.4",
|
|
28
|
+
"version": "2.1.4",
|
|
29
|
+
"comments": {
|
|
30
|
+
"patch": [
|
|
31
|
+
{
|
|
32
|
+
"author": "derek.finlinson@journeyteam.com",
|
|
33
|
+
"package": "dataverse-utils",
|
|
34
|
+
"commit": "fb9365e3fcd8ada0b97dfc4e86661c67332734bf",
|
|
35
|
+
"comment": "Prompt to delete cache on error"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"date": "Sun, 16 Jan 2022 23:22:22 GMT",
|
|
42
|
+
"tag": "dataverse-utils_v2.1.3",
|
|
43
|
+
"version": "2.1.3",
|
|
44
|
+
"comments": {
|
|
45
|
+
"patch": [
|
|
46
|
+
{
|
|
47
|
+
"author": "derek.finlinson@journeyteam.com",
|
|
48
|
+
"package": "dataverse-utils",
|
|
49
|
+
"commit": "928a436f3d6627765a329ee4cb31d83cab714b1d",
|
|
50
|
+
"comment": "Switch symbols"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"date": "Sun, 16 Jan 2022 22:57:20 GMT",
|
|
57
|
+
"tag": "dataverse-utils_v2.1.2",
|
|
58
|
+
"version": "2.1.2",
|
|
59
|
+
"comments": {
|
|
60
|
+
"patch": [
|
|
61
|
+
{
|
|
62
|
+
"author": "derek.finlinson@journeyteam.com",
|
|
63
|
+
"package": "dataverse-utils",
|
|
64
|
+
"commit": "acf6ca4763a9d98fa7683fe517deb872f12f4c42",
|
|
65
|
+
"comment": "Fix logging for real"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"date": "Sun, 16 Jan 2022 22:41:55 GMT",
|
|
6
72
|
"tag": "dataverse-utils_v2.1.1",
|
|
7
73
|
"version": "2.1.1",
|
|
8
74
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,50 @@
|
|
|
1
1
|
# Change Log - dataverse-utils
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 07 Feb 2022 22:01:58 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 2.
|
|
7
|
+
## 2.2.0
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Mon, 07 Feb 2022 22:01:58 GMT
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Minor changes
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- Switch to combined logger (derek.finlinson@journeyteam.com)
|
|
14
|
+
- Bump dataverse-webapi to v2.0.4
|
|
14
15
|
|
|
16
|
+
## 2.1.4
|
|
17
|
+
|
|
18
|
+
Fri, 28 Jan 2022 23:11:16 GMT
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- Prompt to delete cache on error (derek.finlinson@journeyteam.com)
|
|
23
|
+
|
|
24
|
+
## 2.1.3
|
|
25
|
+
|
|
26
|
+
Sun, 16 Jan 2022 23:22:22 GMT
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- Switch symbols (derek.finlinson@journeyteam.com)
|
|
31
|
+
|
|
32
|
+
## 2.1.2
|
|
33
|
+
|
|
34
|
+
Sun, 16 Jan 2022 22:57:20 GMT
|
|
35
|
+
|
|
36
|
+
### Patches
|
|
37
|
+
|
|
38
|
+
- Fix logging for real (derek.finlinson@journeyteam.com)
|
|
39
|
+
|
|
40
|
+
## 2.1.1
|
|
41
|
+
|
|
42
|
+
Sun, 16 Jan 2022 22:41:55 GMT
|
|
43
|
+
|
|
44
|
+
### Patches
|
|
45
|
+
|
|
46
|
+
- Fix logging (derek.finlinson@journeyteam.com)
|
|
47
|
+
|
|
15
48
|
## 2.1.0
|
|
16
49
|
|
|
17
50
|
Sun, 16 Jan 2022 21:30:27 GMT
|
package/lib/logger.js
CHANGED
|
@@ -3,24 +3,34 @@ 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.logger = void 0;
|
|
6
|
+
exports.logger = exports.icons = void 0;
|
|
7
7
|
const kleur_1 = __importDefault(require("kleur"));
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
console[method](timestamp, symbol, ...args);
|
|
8
|
+
const isTest = process.env.JEST_WORKER_ID !== undefined;
|
|
9
|
+
exports.icons = {
|
|
10
|
+
done: kleur_1.default.green('▣'),
|
|
11
|
+
info: kleur_1.default.cyan('!'),
|
|
12
|
+
error: kleur_1.default.red('⨂'),
|
|
13
|
+
warn: kleur_1.default.yellow('‼')
|
|
15
14
|
};
|
|
16
15
|
exports.logger = {
|
|
17
16
|
info(...args) {
|
|
18
|
-
|
|
17
|
+
if (!isTest) {
|
|
18
|
+
console.info(exports.icons.info, ...args);
|
|
19
|
+
}
|
|
19
20
|
},
|
|
20
21
|
warn(...args) {
|
|
21
|
-
|
|
22
|
+
if (!isTest) {
|
|
23
|
+
console.warn(exports.icons.warn, ...args);
|
|
24
|
+
}
|
|
22
25
|
},
|
|
23
26
|
error(...args) {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
if (!isTest) {
|
|
28
|
+
console.error(exports.icons.error, ...args);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
done(...args) {
|
|
32
|
+
if (!isTest) {
|
|
33
|
+
console.info(exports.icons.info, ...args);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
26
36
|
};
|
|
@@ -7,7 +7,7 @@ exports.deployAssembly = void 0;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const pluginAssembly_1 = require("./models/pluginAssembly");
|
|
10
|
-
const logger_1 = require("
|
|
10
|
+
const logger_1 = require("../../../logger");
|
|
11
11
|
async function deployAssembly(creds, apiConfig) {
|
|
12
12
|
const currentPath = '.';
|
|
13
13
|
const configFile = fs_1.default.readFileSync(path_1.default.resolve(currentPath, 'dataverse.config.json'), 'utf8');
|
|
@@ -24,6 +24,6 @@ async function deployAssembly(creds, apiConfig) {
|
|
|
24
24
|
logger_1.logger.error(error.message);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
logger_1.logger.
|
|
27
|
+
logger_1.logger.done(`deployed assembly ${config.name}\r\n`);
|
|
28
28
|
}
|
|
29
29
|
exports.deployAssembly = deployAssembly;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getAccessToken = void 0;
|
|
4
4
|
const cachePlugin_1 = require("./cachePlugin");
|
|
5
5
|
const msal_node_1 = require("@azure/msal-node");
|
|
6
|
-
const logger_1 = require("
|
|
6
|
+
const logger_1 = require("../../../logger");
|
|
7
7
|
const clientId = '51f81489-12ee-4a9e-aaae-a2591f45987d';
|
|
8
8
|
const getAccessToken = async (tenant, url) => {
|
|
9
9
|
const config = {
|
|
@@ -12,7 +12,7 @@ const getAccessToken = async (tenant, url) => {
|
|
|
12
12
|
authority: `https://login.microsoftonline.com/${tenant}/`
|
|
13
13
|
},
|
|
14
14
|
cache: {
|
|
15
|
-
cachePlugin: (0, cachePlugin_1.cachePlugin)(url
|
|
15
|
+
cachePlugin: (0, cachePlugin_1.cachePlugin)(url)
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
const pca = new msal_node_1.PublicClientApplication(config);
|
|
@@ -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.cachePlugin = void 0;
|
|
6
|
+
exports.cachePlugin = exports.deleteCache = exports.cacheExists = exports.getCachePath = 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"));
|
|
@@ -20,14 +20,32 @@ const decrypt = (text) => {
|
|
|
20
20
|
const decrypted = cryptr.decrypt(text);
|
|
21
21
|
return decrypted;
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
const getCachePath = (url) => {
|
|
24
|
+
const org = url.replace('https://', '').split('.')[0];
|
|
25
|
+
if (!fs_1.default.existsSync(path_1.default.join(os_1.default.homedir(), './.dataverse-utils/'))) {
|
|
26
|
+
fs_1.default.mkdirSync(path_1.default.join(os_1.default.homedir(), './.dataverse-utils/'));
|
|
27
|
+
}
|
|
28
|
+
return path_1.default.join(os_1.default.homedir(), `./.dataverse-utils/${org}.json`);
|
|
29
|
+
};
|
|
30
|
+
exports.getCachePath = getCachePath;
|
|
31
|
+
const cacheExists = (url) => {
|
|
32
|
+
const cacheLocation = (0, exports.getCachePath)(url);
|
|
33
|
+
return fs_1.default.existsSync(cacheLocation);
|
|
34
|
+
};
|
|
35
|
+
exports.cacheExists = cacheExists;
|
|
36
|
+
const deleteCache = (url) => {
|
|
37
|
+
const cacheLocation = (0, exports.getCachePath)(url);
|
|
38
|
+
if (fs_1.default.existsSync(cacheLocation)) {
|
|
39
|
+
fs_1.default.unlinkSync(cacheLocation);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.deleteCache = deleteCache;
|
|
47
|
+
const cachePlugin = (url) => {
|
|
48
|
+
const cacheLocation = (0, exports.getCachePath)(url);
|
|
31
49
|
const beforeCacheAccess = (tokenCacheContext) => {
|
|
32
50
|
return new Promise((resolve, reject) => {
|
|
33
51
|
if (fs_1.default.existsSync(cacheLocation)) {
|
|
@@ -75,5 +93,5 @@ function cachePlugin(org) {
|
|
|
75
93
|
beforeCacheAccess,
|
|
76
94
|
afterCacheAccess
|
|
77
95
|
};
|
|
78
|
-
}
|
|
96
|
+
};
|
|
79
97
|
exports.cachePlugin = cachePlugin;
|
|
File without changes
|
|
@@ -6,11 +6,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const prompts_1 = __importDefault(require("prompts"));
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const logger_1 = require("
|
|
9
|
+
const logger_1 = require("../../../logger");
|
|
10
10
|
const assemblyDeploy_1 = require("./assemblyDeploy");
|
|
11
11
|
const webResourceDeploy_1 = require("./webResourceDeploy");
|
|
12
12
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
13
13
|
const auth_1 = require("./auth");
|
|
14
|
+
const cachePlugin_1 = require("./cachePlugin");
|
|
15
|
+
const onTokenFailure = async (url, error) => {
|
|
16
|
+
if (error) {
|
|
17
|
+
logger_1.logger.error(`failed to acquire access token: ${error}`);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
logger_1.logger.error('failed to acquire access token');
|
|
21
|
+
}
|
|
22
|
+
if ((0, cachePlugin_1.cacheExists)(url)) {
|
|
23
|
+
const { deleteToken } = await (0, prompts_1.default)({
|
|
24
|
+
type: 'confirm',
|
|
25
|
+
name: 'deleteToken',
|
|
26
|
+
message: `delete current token cache for ${url}?`
|
|
27
|
+
});
|
|
28
|
+
if (deleteToken) {
|
|
29
|
+
(0, cachePlugin_1.deleteCache)(url);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
14
33
|
async function deploy(type, files) {
|
|
15
34
|
if (!type || (type !== 'webresource' && type !== 'assembly')) {
|
|
16
35
|
const invalid = type !== undefined && type !== 'webresource' && type !== 'assembly';
|
|
@@ -38,11 +57,11 @@ async function deploy(type, files) {
|
|
|
38
57
|
token = await (0, auth_1.getAccessToken)(creds.tenant, creds.server);
|
|
39
58
|
}
|
|
40
59
|
catch (error) {
|
|
41
|
-
|
|
60
|
+
onTokenFailure(creds.server, error.message);
|
|
42
61
|
return;
|
|
43
62
|
}
|
|
44
63
|
if (token == null || token.accessToken == null) {
|
|
45
|
-
|
|
64
|
+
onTokenFailure(creds.server);
|
|
46
65
|
return;
|
|
47
66
|
}
|
|
48
67
|
const apiConfig = new node_1.WebApiConfig('8.2', token.accessToken, creds.server);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const prompts_1 = __importDefault(require("prompts"));
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const logger_1 = require("
|
|
9
|
+
const logger_1 = require("../../../logger");
|
|
10
10
|
const dataverse_service_1 = require("./dataverse.service");
|
|
11
11
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
12
12
|
const auth_1 = require("./auth");
|
|
@@ -94,6 +94,6 @@ async function generate(table) {
|
|
|
94
94
|
fs_1.default.mkdirSync(path_1.default.resolve(currentPath, 'src', 'scripts', 'models'));
|
|
95
95
|
}
|
|
96
96
|
fs_1.default.writeFileSync(path_1.default.resolve(currentPath, 'src', 'scripts', 'models', `${metadata.schemaName}.ts`), codeFile);
|
|
97
|
-
logger_1.logger.
|
|
97
|
+
logger_1.logger.done(`Table metadata output to models/${metadata.schemaName}.ts`);
|
|
98
98
|
}
|
|
99
99
|
exports.default = generate;
|
|
File without changes
|
|
@@ -9,11 +9,11 @@ const glob_1 = __importDefault(require("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
|
-
const logger_1 = require("
|
|
12
|
+
const logger_1 = require("../../../../logger");
|
|
13
13
|
async function deploy(config, apiConfig, solution) {
|
|
14
14
|
const files = glob_1.default.sync(`**/${config.name}.dll`);
|
|
15
15
|
if (files.length === 0) {
|
|
16
|
-
logger_1.logger.
|
|
16
|
+
logger_1.logger.warn(`assembly ${config.name}.dll not found`);
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const content = fs_1.default.readFileSync(files[0]).toString('base64');
|
|
@@ -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 (0, pluginType_1.deployType)(type, apiConfig, solution);
|
|
56
|
+
await (0, pluginType_1.deployType)(type, assemblyId, apiConfig, solution);
|
|
57
57
|
});
|
|
58
58
|
await Promise.all(promises);
|
|
59
59
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deployImage = void 0;
|
|
4
|
-
const logger_1 = require("
|
|
4
|
+
const logger_1 = require("../../../../logger");
|
|
5
5
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
6
6
|
async function deployImage(stepId, image, message, apiConfig) {
|
|
7
7
|
image['sdkmessageprocessingstepid@odata.bind'] = `/sdkmessageprocessingsteps(${stepId})`;
|
|
@@ -3,18 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deployStep = void 0;
|
|
4
4
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
5
5
|
const dataverse_service_1 = require("../dataverse.service");
|
|
6
|
-
const logger_1 = require("
|
|
6
|
+
const logger_1 = require("../../../../logger");
|
|
7
7
|
const pluginImage_1 = require("./pluginImage");
|
|
8
|
-
async function deployStep(step, apiConfig, solution) {
|
|
9
|
-
let stepId = await retrieveStep(step.name, apiConfig);
|
|
8
|
+
async function deployStep(step, typeId, apiConfig, solution) {
|
|
9
|
+
let stepId = await retrieveStep(step.name, typeId, apiConfig);
|
|
10
10
|
const messageId = await getSdkMessageId(step.message ?? '', apiConfig);
|
|
11
11
|
if (messageId == '') {
|
|
12
|
-
logger_1.logger.
|
|
12
|
+
logger_1.logger.warn(`sdk message ${step.message} not found`);
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
const filterId = await getSdkMessageFilterId(messageId, step.entity ?? '', apiConfig);
|
|
16
16
|
if (filterId == '') {
|
|
17
|
-
logger_1.logger.
|
|
17
|
+
logger_1.logger.warn(`sdk message ${step.message} for entity ${step.entity} not found`);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
step['sdkmessagefilterid@odata.bind'] = `/sdkmessagefilters(${filterId})`;
|
|
@@ -63,8 +63,8 @@ async function deployStep(step, apiConfig, solution) {
|
|
|
63
63
|
return stepId;
|
|
64
64
|
}
|
|
65
65
|
exports.deployStep = deployStep;
|
|
66
|
-
async function retrieveStep(name, apiConfig) {
|
|
67
|
-
const options = `$select=sdkmessageprocessingstepid&$filter=name eq '${name}'`;
|
|
66
|
+
async function retrieveStep(name, typeId, apiConfig) {
|
|
67
|
+
const options = `$select=sdkmessageprocessingstepid&$filter=name eq '${name}' and _plugintypeid_value eq ${typeId}`;
|
|
68
68
|
const result = await (0, node_1.retrieveMultiple)(apiConfig, 'sdkmessageprocessingsteps', options);
|
|
69
69
|
return result.value.length > 0 ? result.value[0].sdkmessageprocessingstepid : '';
|
|
70
70
|
}
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deployType = void 0;
|
|
4
4
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
5
5
|
const pluginStep_1 = require("./pluginStep");
|
|
6
|
-
const logger_1 = require("
|
|
7
|
-
async function deployType(type, apiConfig, solution) {
|
|
8
|
-
let typeId = await retrieveType(type.typename, apiConfig);
|
|
6
|
+
const logger_1 = require("../../../../logger");
|
|
7
|
+
async function deployType(type, assemblyId, apiConfig, solution) {
|
|
8
|
+
let typeId = await retrieveType(type.typename, assemblyId, apiConfig);
|
|
9
9
|
const record = {
|
|
10
10
|
name: type.name,
|
|
11
11
|
friendlyname: type.friendlyname,
|
|
@@ -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 (0, pluginStep_1.deployStep)(step, apiConfig, solution);
|
|
36
|
+
await (0, pluginStep_1.deployStep)(step, typeId, apiConfig, solution);
|
|
37
37
|
});
|
|
38
38
|
await Promise.all(promises);
|
|
39
39
|
}
|
|
@@ -44,8 +44,8 @@ async function deployType(type, apiConfig, solution) {
|
|
|
44
44
|
return typeId;
|
|
45
45
|
}
|
|
46
46
|
exports.deployType = deployType;
|
|
47
|
-
async function retrieveType(name, apiConfig) {
|
|
48
|
-
const options = `$select=plugintypeid&$filter=typename eq '${name}'`;
|
|
47
|
+
async function retrieveType(name, assemblyId, apiConfig) {
|
|
48
|
+
const options = `$select=plugintypeid&$filter=typename eq '${name}' and _pluginassemblyid_value eq ${assemblyId}`;
|
|
49
49
|
const result = await (0, node_1.retrieveMultiple)(apiConfig, 'plugintypes', options);
|
|
50
50
|
return result.value.length > 0 ? result.value[0].plugintypeid : '';
|
|
51
51
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.deploy = void 0;
|
|
7
7
|
const dataverse_service_1 = require("../dataverse.service");
|
|
8
8
|
const node_1 = require("dataverse-webapi/lib/node");
|
|
9
|
-
const logger_1 = require("
|
|
9
|
+
const logger_1 = require("../../../../logger");
|
|
10
10
|
const fs_1 = __importDefault(require("fs"));
|
|
11
11
|
function getWebResourceType(type) {
|
|
12
12
|
switch (type) {
|
|
@@ -47,7 +47,7 @@ async function deploy(webResources, apiConfig, solution, files) {
|
|
|
47
47
|
for (const file of files.split(',')) {
|
|
48
48
|
const resource = webResources.filter(r => r.path?.endsWith(file));
|
|
49
49
|
if (resource.length === 0) {
|
|
50
|
-
logger_1.logger.
|
|
50
|
+
logger_1.logger.warn(`web resource ${file} not found in dataverse.config.json`);
|
|
51
51
|
continue;
|
|
52
52
|
}
|
|
53
53
|
resources.push(resource[0]);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.deployWebResource = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const logger_1 = require("
|
|
9
|
+
const logger_1 = require("../../../logger");
|
|
10
10
|
const webResource_1 = require("./models/webResource");
|
|
11
11
|
async function deployWebResource(creds, apiConfig, files) {
|
|
12
12
|
const currentPath = '.';
|
|
@@ -24,6 +24,6 @@ async function deployWebResource(creds, apiConfig, files) {
|
|
|
24
24
|
logger_1.logger.error(error.message);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
logger_1.logger.
|
|
27
|
+
logger_1.logger.done('deployed web resources');
|
|
28
28
|
}
|
|
29
29
|
exports.deployWebResource = deployWebResource;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dataverse-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Utilities for interacting with Dataverse environments",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -17,21 +17,22 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsc -p .",
|
|
19
19
|
"lint": "eslint",
|
|
20
|
-
"
|
|
20
|
+
"clean": "rimraf lib"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@azure/msal-node": "^1.3.1",
|
|
24
24
|
"commander": "^8.3.0",
|
|
25
|
-
"glob": "^7.2.0",
|
|
26
25
|
"cryptr": "^6.0.2",
|
|
27
|
-
"dataverse-webapi": "^2.0.
|
|
26
|
+
"dataverse-webapi": "^2.0.4",
|
|
28
27
|
"envinfo": "^7.8.1",
|
|
28
|
+
"glob": "^7.2.0",
|
|
29
29
|
"kleur": "^4.1.4",
|
|
30
30
|
"prompts": "^2.4.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/
|
|
33
|
+
"@types/cryptr": "^4.0.1",
|
|
34
34
|
"@types/glob": "^7.2.0",
|
|
35
|
+
"@types/node": "^16.9.1",
|
|
35
36
|
"@types/prompts": "^2.0.14"
|
|
36
37
|
}
|
|
37
38
|
}
|