Skip to content

Commit bebabf7

Browse files
committed
v10.12
1 parent d60ab47 commit bebabf7

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

projects.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ function init(inDomainName, inUsername, inPassword,inTimeout,inPrettyprint){
2525
prettyprint = inPrettyprint;
2626

2727
url = "https://" + domainName + "/apis/v1/rest/projects";
28-
//console.log("Username [" + username + "]");
29-
//console.log("URL [" + url + "]");
30-
//console.log("Timeout [" + timeout + "]");
3128
}
3229

3330
/**

wmiocli.js

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ var wf = require('./workflow.js');
1111
var dbg = require('./debug.js');
1212
var flowservice = require('./flowservice.js');
1313
var prettyprint = false;
14+
var compat = false;
1415

1516
const { Command, Option } = require('commander');
1617
const { exit } = require('process');
1718

18-
function checkEnableDebug(){
19+
function checkOptions(){
1920
if(program.opts().verbose==true){
2021
dbg.enableDebug();
2122
}
@@ -24,6 +25,7 @@ function checkEnableDebug(){
2425
{
2526
prettyprint = true;
2627
}
28+
2729
}
2830

2931
function debug(message){
@@ -33,7 +35,7 @@ const program = new Command();
3335
program
3436

3537
//Program Info
36-
.version('2022.04.1')
38+
.version('2022.07.1')
3739

3840
//required options
3941
.requiredOption('-d, --domain <tenantDomain>', 'Tenant Doamin Name, e.g. "tenant.int-aws-us.webmethods.io"')
@@ -44,6 +46,7 @@ program
4446
.addOption(new Option('-t, --timeout <delay>', 'timeout in seconds').default(60, 'one minute'))
4547
.option('--prettyprint','Pretty Print JSON output')
4648
.option('--verbose','Verbose output useful for diagnosing issues')
49+
4750

4851
//Additional help
4952
.addHelpText('before', `
@@ -208,7 +211,7 @@ Examples:
208211
program.command('project [project-name]')
209212
.description('Lists all projects or view an individual project, specified via project name or uid')
210213
.action((projectName) => {
211-
checkEnableDebug();
214+
checkOptions();
212215
project.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
213216
var resp = project.list(projectName);
214217
if(resp)console.log(resp);
@@ -217,7 +220,7 @@ program.command('project [project-name]')
217220
program.command('project-assets <project-name>')
218221
.description('Lists project assets from given project name or uid')
219222
.action((projectName) => {
220-
checkEnableDebug();
223+
checkOptions();
221224
project.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
222225
var resp = project.listAssets(projectName);
223226
if(resp)console.log(resp);
@@ -226,31 +229,31 @@ program.command('project-assets <project-name>')
226229
program.command('project-create <project-name>')
227230
.description('Create project with given name')
228231
.action((projectName) => {
229-
checkEnableDebug();
232+
checkOptions();
230233
project.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
231234
project.create(projectName);
232235
});
233236

234237
program.command('project-update <project-id> <project-name>')
235238
.description('Update project with new name')
236239
.action((projectId, projectName) => {
237-
checkEnableDebug();
240+
checkOptions();
238241
project.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
239242
project.update(projectId, projectName);
240243
});
241244

242245
program.command('project-delete <project-id>')
243246
.description('Delete project with given id')
244247
.action((projectId) => {
245-
checkEnableDebug();
248+
checkOptions();
246249
project.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
247250
project.del(projectId);
248251
});
249252

250253
program.command('project-publish <project-id> <publish-name> <target-tenant-domain-name> <target-user-id> <target-user-password> <assets-json>')
251254
.description('Pubilsh project to another tenant with given id')
252255
.action((projectId,publishName,targetTenantDomainName,targetUserId,targetUserPassword,assetsJson) => {
253-
checkEnableDebug();
256+
checkOptions();
254257
project.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
255258
project.pub(projectId,publishName,targetTenantDomainName,targetUserId,targetUserPassword,assetsJson);
256259

@@ -259,7 +262,7 @@ program.command('project-publish <project-id> <publish-name> <target-tenant-doma
259262
program.command('project-deploy <projectName> <version>')
260263
.description('deploy published project with given version into tenant')
261264
.action((projectName, version) => {
262-
checkEnableDebug();
265+
checkOptions();
263266
project.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
264267
project.deploy(projectName,version);
265268
});
@@ -272,7 +275,7 @@ program.command('project-deploy <projectName> <version>')
272275
program.command('role [role-id]')
273276
.description('Lists all roles or views an individual role')
274277
.action((roleId) => {
275-
checkEnableDebug();
278+
checkOptions();
276279
role.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
277280
var resp = role.list(roleId);
278281
if(resp)console.log(resp);
@@ -281,23 +284,23 @@ program.command('role [role-id]')
281284
program.command('role-create <role-name> <role-description> <roles-list>')
282285
.description('Create roles and specify the permissions for that role. Roles-list should be provided as follows projectName,r,w,e;project name 2,r;')
283286
.action((roleName,roleDescription,rolesList) => {
284-
checkEnableDebug();
287+
checkOptions();
285288
role.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint);
286289
role.insert(roleName,roleDescription, rolesList);
287290
});
288291

289292
program.command('role-update <role-id> <role-name> <role-description> <roles-list>')
290293
.description('Create roles and specify the permissions for that role. Roles-list should be provided as follows projectName,r,w,e;project name 2,r;')
291294
.action((roleId, roleName,roleDescription,rolesList) => {
292-
checkEnableDebug();
295+
checkOptions();
293296
role.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint);
294297
role.update(roleId, roleName,roleDescription, rolesList);
295298
});
296299

297300
program.command('role-delete <role-name>')
298301
.description('Delete a roles with the given role name')
299302
.action((roleId, roleName,roleDescription,rolesList) => {
300-
checkEnableDebug();
303+
checkOptions();
301304
role.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint);
302305
role.del(roleId);
303306
});
@@ -314,15 +317,15 @@ program.command('role-delete <role-name>')
314317
program.command('user')
315318
.description('Lists all users')
316319
.action(() => {
317-
checkEnableDebug();
320+
checkOptions();
318321
user.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint);
319322
user.list(undefined);
320323
});
321324

322325
program.command('user-role-assignment <user-id> <role-names>')
323326
.description('Assigns a user to roles')
324327
.action((userId,roleNames) => {
325-
checkEnableDebug();
328+
checkOptions();
326329
debug("userId: " + userId);
327330
debug("Roles: " + roleNames);
328331
user.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint);
@@ -337,15 +340,15 @@ program.command('user-role-assignment <user-id> <role-names>')
337340
program.command('workflow-export <project-id> <workflow-id> <filename>')
338341
.description('Export workflow with id <workflow-id> from project <project-id>')
339342
.action((projectId, workflowId, filename) => {
340-
checkEnableDebug();
343+
checkOptions();
341344
wf.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,projectId);
342345
wf.exportwf(workflowId,filename);
343346
});
344347

345348
program.command('workflow-import <project-id> <filename>')
346349
.description('Import workflow into project <project-id> from file <filename>')
347350
.action((projectId, filename) => {
348-
checkEnableDebug();
351+
checkOptions();
349352
debug("Importing Workflow");
350353
wf.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,projectId);
351354
wf.importwf(filename);
@@ -354,7 +357,7 @@ program.command('workflow-import <project-id> <filename>')
354357
program.command('workflow-delete <project-id> <workflow-id>')
355358
.description('Delete workflow <workflow-id> from project <project-id>')
356359
.action((projectId, workflowId) => {
357-
checkEnableDebug();
360+
checkOptions();
358361
debug("Deleting Workflow [" + workflowId + "]");
359362
wf.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,projectId);
360363
wf.deletewf(workflowId);
@@ -363,15 +366,15 @@ program.command('workflow-delete <project-id> <workflow-id>')
363366
program.command('workflow-execute <project-id> <workflow-id>')
364367
.description('Execute workflow <workflow-id> from project <project-id>')
365368
.action((projectId, workflowId) => {
366-
checkEnableDebug();
369+
checkOptions();
367370
wf.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,projectId);
368371
wf.runwf(workflowId)
369372
});
370373

371374
program.command('workflow-status <project-id> <run-id>')
372375
.description('Gets Execution status for workflow execution <run-id>')
373376
.action((projectId, runId) => {
374-
checkEnableDebug();
377+
checkOptions();
375378
wf.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,projectId);
376379
wf.statuswf(runId);
377380
});
@@ -384,31 +387,31 @@ program.command('workflow-status <project-id> <run-id>')
384387
program.command('flowservice-export <project-id> <flow-name> <file-name>')
385388
.description('Export FlowService with name <flow-name> from project <project-id>')
386389
.action((projectId, flowName,filename) => {
387-
checkEnableDebug();
390+
checkOptions();
388391
flowservice.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,projectId);
389392
flowservice.exportFlowService(flowName,filename);
390393
});
391394

392395
program.command('flowservice-import <project-id> <filename>')
393396
.description('Import FlowService from <filename> into project <project-id>')
394397
.action((projectId, filename) => {
395-
checkEnableDebug();
398+
checkOptions();
396399
flowservice.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,projectId);
397400
flowservice.importFlowService(filename);
398401
});
399402

400403
program.command('flowservice-delete <project-id> <flow-name>')
401404
.description('Delete FlowService <flow-name> from project <project-id>')
402405
.action((projectId, flowName) => {
403-
checkEnableDebug();
406+
checkOptions();
404407
flowservice.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,projectId);
405408
flowservice.deleteFlowService(flowName);
406409
});
407410

408411
program.command('flowservice-execute <project-id> <flow-name> [input-json]')
409412
.description('Execute FlowService <flow-name> from project <project-id> with data <input-json>')
410413
.action((projectId, flowName,inputJson) => {
411-
checkEnableDebug();
414+
checkOptions();
412415
flowservice.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,projectId);
413416
flowservice.runFlowService(flowName,inputJson);
414417
});

0 commit comments

Comments
 (0)