dataverse-utils 2.0.10 → 2.1.1
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 +281 -0
- package/CHANGELOG.md +134 -0
- package/lib/assemblyDeploy.js +18 -11
- package/lib/auth.js +11 -7
- package/lib/cachePlugin.js +23 -16
- package/lib/dataverse.service.js +16 -10
- package/lib/deploy.js +24 -18
- package/lib/generate.js +28 -22
- package/lib/index.js +45 -0
- package/lib/logger.js +26 -0
- package/lib/models/pluginAssembly.js +27 -20
- package/lib/models/pluginImage.js +12 -8
- package/lib/models/pluginStep.js +20 -16
- package/lib/models/pluginType.js +14 -10
- package/lib/models/webResource.js +26 -19
- package/lib/webResourceDeploy.js +18 -11
- package/package.json +6 -6
- package/lib/assemblyDeploy.d.ts +0 -3
- package/lib/auth.d.ts +0 -2
- package/lib/cachePlugin.d.ts +0 -2
- package/lib/dataverse-utils.d.ts +0 -2
- package/lib/dataverse-utils.js +0 -38
- package/lib/dataverse.service.d.ts +0 -34
- package/lib/deploy.d.ts +0 -1
- package/lib/generate.d.ts +0 -1
- package/lib/models/pluginAssembly.d.ts +0 -13
- package/lib/models/pluginImage.d.ts +0 -10
- package/lib/models/pluginStep.d.ts +0 -20
- package/lib/models/pluginType.d.ts +0 -11
- package/lib/models/webResource.d.ts +0 -10
- package/lib/webResourceDeploy.d.ts +0 -3
package/lib/webResourceDeploy.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.deployWebResource = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const logger_1 = require("./logger");
|
|
10
|
+
const webResource_1 = require("./models/webResource");
|
|
11
|
+
async function deployWebResource(creds, apiConfig, files) {
|
|
6
12
|
const currentPath = '.';
|
|
7
|
-
const configFile =
|
|
13
|
+
const configFile = fs_1.default.readFileSync(path_1.default.resolve(currentPath, 'dataverse.config.json'), 'utf8');
|
|
8
14
|
if (configFile == null) {
|
|
9
|
-
logger.warn('unable to find dataverse.config.json file');
|
|
15
|
+
logger_1.logger.warn('unable to find dataverse.config.json file');
|
|
10
16
|
return;
|
|
11
17
|
}
|
|
12
18
|
const config = JSON.parse(configFile).webResources;
|
|
13
|
-
logger.info('deploy web resources');
|
|
19
|
+
logger_1.logger.info('deploy web resources');
|
|
14
20
|
try {
|
|
15
|
-
await deploy(config, apiConfig, creds.solution, files);
|
|
21
|
+
await (0, webResource_1.deploy)(config, apiConfig, creds.solution, files);
|
|
16
22
|
}
|
|
17
23
|
catch (error) {
|
|
18
|
-
logger.error(error.message);
|
|
24
|
+
logger_1.logger.error(error.message);
|
|
19
25
|
return;
|
|
20
26
|
}
|
|
21
|
-
logger.info('deployed web resources');
|
|
27
|
+
logger_1.logger.info('deployed web resources');
|
|
22
28
|
}
|
|
29
|
+
exports.deployWebResource = deployWebResource;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dataverse-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Utilities for interacting with Dataverse environments",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"dataverse-utils": "lib/
|
|
8
|
+
"dataverse-utils": "lib/index.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"/lib"
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@azure/msal-node": "^1.3.1",
|
|
24
|
-
"commander": "^8.
|
|
24
|
+
"commander": "^8.3.0",
|
|
25
25
|
"glob": "^7.2.0",
|
|
26
26
|
"cryptr": "^6.0.2",
|
|
27
|
-
"dataverse-webapi": "^2.0.
|
|
27
|
+
"dataverse-webapi": "^2.0.3",
|
|
28
28
|
"envinfo": "^7.8.1",
|
|
29
|
-
"
|
|
30
|
-
"prompts": "^2.4.
|
|
29
|
+
"kleur": "^4.1.4",
|
|
30
|
+
"prompts": "^2.4.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^16.9.1",
|
package/lib/assemblyDeploy.d.ts
DELETED
package/lib/auth.d.ts
DELETED
package/lib/cachePlugin.d.ts
DELETED
package/lib/dataverse-utils.d.ts
DELETED
package/lib/dataverse-utils.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { program } from 'commander';
|
|
3
|
-
import deploy from './deploy';
|
|
4
|
-
import generate from './generate';
|
|
5
|
-
program
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
7
|
-
.version(require('../package').version)
|
|
8
|
-
.usage('<command> [options]');
|
|
9
|
-
// Deploy command
|
|
10
|
-
program
|
|
11
|
-
.command('deploy')
|
|
12
|
-
.description('Deploy file(s) to dataverse (webresource, plugin, workflow)')
|
|
13
|
-
.argument('[type]', 'Type of project to deploy')
|
|
14
|
-
.argument('[files]', 'Comma separate list of files to deploy')
|
|
15
|
-
.action((type, files) => {
|
|
16
|
-
deploy(type, files);
|
|
17
|
-
});
|
|
18
|
-
// Generate command
|
|
19
|
-
program
|
|
20
|
-
.command('generate')
|
|
21
|
-
.description('Generate early-bound TypeScript file for specified table')
|
|
22
|
-
.argument('[table]', 'Table to generate')
|
|
23
|
-
.action((table) => {
|
|
24
|
-
generate(table);
|
|
25
|
-
});
|
|
26
|
-
// Show help on unknown command
|
|
27
|
-
program
|
|
28
|
-
.arguments('<command>')
|
|
29
|
-
.action((cmd) => {
|
|
30
|
-
program.outputHelp();
|
|
31
|
-
console.log();
|
|
32
|
-
console.log(`Unknown command ${cmd}.`);
|
|
33
|
-
console.log();
|
|
34
|
-
});
|
|
35
|
-
program.parse(process.argv);
|
|
36
|
-
if (!process.argv.slice(2).length) {
|
|
37
|
-
program.outputHelp();
|
|
38
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { WebApiConfig } from 'dataverse-webapi/lib/node';
|
|
2
|
-
export declare enum ComponentType {
|
|
3
|
-
WebResource = 61,
|
|
4
|
-
PluginType = 90,
|
|
5
|
-
PluginAssembly = 91,
|
|
6
|
-
SDKMessageProcessingStep = 92,
|
|
7
|
-
SDKMessageProcessingStepImage = 93
|
|
8
|
-
}
|
|
9
|
-
export interface DeployCredentials {
|
|
10
|
-
server: string;
|
|
11
|
-
tenant: string;
|
|
12
|
-
solution: string;
|
|
13
|
-
}
|
|
14
|
-
export interface Choice {
|
|
15
|
-
column: string;
|
|
16
|
-
options: {
|
|
17
|
-
text: string;
|
|
18
|
-
value: number;
|
|
19
|
-
}[];
|
|
20
|
-
}
|
|
21
|
-
export interface TableColumn {
|
|
22
|
-
logicalName: string;
|
|
23
|
-
schemaName: string;
|
|
24
|
-
}
|
|
25
|
-
export interface TableMetadata {
|
|
26
|
-
logicalName: string;
|
|
27
|
-
schemaName: string;
|
|
28
|
-
entitySetName: string;
|
|
29
|
-
fields: TableColumn[];
|
|
30
|
-
choices: Choice[];
|
|
31
|
-
}
|
|
32
|
-
export declare function addToSolution(id: string, solution: string, type: ComponentType, apiConfig: WebApiConfig): Promise<void>;
|
|
33
|
-
export declare function publish(publishXml: string, apiConfig: WebApiConfig): Promise<void>;
|
|
34
|
-
export declare function getTableMetadata(table: string, apiConfig: WebApiConfig): Promise<TableMetadata>;
|
package/lib/deploy.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function deploy(type?: string, files?: string): Promise<void>;
|
package/lib/generate.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function generate(table: string): Promise<void>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { WebApiConfig, Entity } from 'dataverse-webapi/lib/node';
|
|
2
|
-
import { PluginType } from './pluginType';
|
|
3
|
-
export interface PluginAssembly extends Entity {
|
|
4
|
-
name: string;
|
|
5
|
-
content?: string;
|
|
6
|
-
isolationmode?: number;
|
|
7
|
-
version?: string;
|
|
8
|
-
publickeytoken?: string;
|
|
9
|
-
sourcetype?: number;
|
|
10
|
-
culture?: string;
|
|
11
|
-
types?: PluginType[];
|
|
12
|
-
}
|
|
13
|
-
export declare function deploy(config: PluginAssembly, apiConfig: WebApiConfig, solution?: string): Promise<void>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Entity, WebApiConfig } from 'dataverse-webapi/lib/node';
|
|
2
|
-
export interface PluginImage extends Entity {
|
|
3
|
-
name: string;
|
|
4
|
-
entityalias: string;
|
|
5
|
-
attributes: string;
|
|
6
|
-
imagetype: number;
|
|
7
|
-
messagepropertyname: string;
|
|
8
|
-
'sdkmessageprocessingstepid@odata.bind'?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function deployImage(stepId: string, image: PluginImage, message: string | undefined, apiConfig: WebApiConfig): Promise<string>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { WebApiConfig, Entity } from 'dataverse-webapi/lib/node';
|
|
2
|
-
import { PluginImage } from './pluginImage';
|
|
3
|
-
export interface PluginStep extends Entity {
|
|
4
|
-
name: string;
|
|
5
|
-
configuration: number;
|
|
6
|
-
description?: string;
|
|
7
|
-
mode: number;
|
|
8
|
-
rank: number;
|
|
9
|
-
stage: number;
|
|
10
|
-
images?: PluginImage[];
|
|
11
|
-
supporteddeployment: number;
|
|
12
|
-
message?: string;
|
|
13
|
-
entity?: string;
|
|
14
|
-
asyncautodelete?: boolean;
|
|
15
|
-
'plugintypeid@odata.bind'?: string;
|
|
16
|
-
'sdkmessagefilterid@odata.bind'?: string;
|
|
17
|
-
'sdkmessageid@odata.bind'?: string;
|
|
18
|
-
filteringattributes?: string;
|
|
19
|
-
}
|
|
20
|
-
export declare function deployStep(step: PluginStep, apiConfig: WebApiConfig, solution?: string): Promise<string | undefined>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { WebApiConfig, Entity } from 'dataverse-webapi/lib/node';
|
|
2
|
-
import { PluginStep } from './pluginStep';
|
|
3
|
-
export interface PluginType extends Entity {
|
|
4
|
-
name: string;
|
|
5
|
-
'pluginassemblyid@odata.bind'?: string;
|
|
6
|
-
typename: string;
|
|
7
|
-
friendlyname: string;
|
|
8
|
-
steps?: PluginStep[];
|
|
9
|
-
workflowactivitygroupname: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function deployType(type: PluginType, apiConfig: WebApiConfig, solution?: string): Promise<string>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { WebApiConfig } from 'dataverse-webapi/lib/node';
|
|
2
|
-
export interface WebResource {
|
|
3
|
-
displayname: string;
|
|
4
|
-
name: string;
|
|
5
|
-
type: string;
|
|
6
|
-
content: string;
|
|
7
|
-
path: string;
|
|
8
|
-
webresourcetype: number;
|
|
9
|
-
}
|
|
10
|
-
export declare function deploy(webResources: WebResource[], apiConfig: WebApiConfig, solution?: string, files?: string): Promise<void>;
|