legispro-cli 1.0.7 → 1.0.9

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.
Files changed (76) hide show
  1. package/README.md +43 -17
  2. package/bin/dev.cmd +1 -1
  3. package/bin/dev.js +5 -0
  4. package/bin/run.js +5 -0
  5. package/dist/commands/backup/create.js +13 -16
  6. package/dist/commands/backup/list.js +15 -18
  7. package/dist/commands/collection/add.d.ts +3 -3
  8. package/dist/commands/collection/add.js +31 -34
  9. package/dist/commands/collection/create.d.ts +5 -5
  10. package/dist/commands/collection/create.js +40 -43
  11. package/dist/commands/collection/delete.d.ts +1 -1
  12. package/dist/commands/collection/delete.js +20 -23
  13. package/dist/commands/collection/download.d.ts +2 -2
  14. package/dist/commands/collection/download.js +28 -31
  15. package/dist/commands/collection/get.d.ts +1 -1
  16. package/dist/commands/collection/get.js +21 -24
  17. package/dist/commands/collection/list.js +13 -16
  18. package/dist/commands/collection/perms.d.ts +3 -3
  19. package/dist/commands/collection/perms.js +29 -32
  20. package/dist/commands/collection/update.d.ts +7 -7
  21. package/dist/commands/collection/update.js +50 -54
  22. package/dist/commands/collection/upload.d.ts +3 -3
  23. package/dist/commands/collection/upload.js +39 -42
  24. package/dist/commands/config/get.d.ts +5 -1
  25. package/dist/commands/config/get.js +7 -10
  26. package/dist/commands/config/set.d.ts +5 -1
  27. package/dist/commands/config/set.js +41 -24
  28. package/dist/commands/db/init.js +18 -21
  29. package/dist/commands/db/memory.js +10 -12
  30. package/dist/commands/db/uptime.js +8 -10
  31. package/dist/commands/db/version.js +8 -10
  32. package/dist/commands/deploy/index.d.ts +10 -0
  33. package/dist/commands/deploy/index.js +130 -0
  34. package/dist/commands/document/copy.js +15 -18
  35. package/dist/commands/document/list.js +15 -18
  36. package/dist/commands/group/create.d.ts +5 -5
  37. package/dist/commands/group/create.js +36 -39
  38. package/dist/commands/group/delete.d.ts +1 -1
  39. package/dist/commands/group/delete.js +19 -22
  40. package/dist/commands/group/get.d.ts +1 -1
  41. package/dist/commands/group/get.js +20 -23
  42. package/dist/commands/group/list.js +8 -10
  43. package/dist/commands/group/update.d.ts +5 -5
  44. package/dist/commands/group/update.js +36 -39
  45. package/dist/commands/locks/add.js +16 -18
  46. package/dist/commands/locks/clear.js +11 -13
  47. package/dist/commands/services/health.js +11 -14
  48. package/dist/commands/user/create.d.ts +17 -17
  49. package/dist/commands/user/create.js +104 -107
  50. package/dist/commands/user/delete.d.ts +1 -1
  51. package/dist/commands/user/delete.js +24 -27
  52. package/dist/commands/user/get.d.ts +1 -1
  53. package/dist/commands/user/get.js +20 -23
  54. package/dist/commands/user/list.js +10 -13
  55. package/dist/commands/user/login.d.ts +2 -2
  56. package/dist/commands/user/login.js +30 -33
  57. package/dist/commands/user/update.d.ts +16 -16
  58. package/dist/commands/user/update.js +108 -111
  59. package/dist/index.js +1 -5
  60. package/dist/lib/fusiondb-client.d.ts +2 -1
  61. package/dist/lib/fusiondb-client.js +19 -18
  62. package/dist/lib/gh.d.ts +26 -0
  63. package/dist/lib/gh.js +37 -0
  64. package/dist/lib/rclone-client.js +12 -15
  65. package/dist/lib/shell.d.ts +24 -0
  66. package/dist/lib/shell.js +76 -0
  67. package/dist/lib/types.js +1 -2
  68. package/dist/lib/utils.d.ts +2 -2
  69. package/dist/lib/utils.js +4 -7
  70. package/dist/lib/xml-templates.js +6 -10
  71. package/oclif.manifest.json +972 -533
  72. package/package.json +51 -47
  73. package/bin/dev +0 -17
  74. package/bin/run +0 -5
  75. package/dist/commands/locks/list.d.ts +0 -7
  76. package/dist/commands/locks/list.js +0 -86
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const core_1 = require("@oclif/core");
5
- const enquirer_1 = require("enquirer");
6
- const path_1 = tslib_1.__importDefault(require("path"));
7
- const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
8
- class ConfigSet extends core_1.Command {
1
+ import { Command, Flags } from '@oclif/core';
2
+ import enquirer from 'enquirer';
3
+ import path from 'path';
4
+ import fs from 'fs-extra';
5
+ class ConfigSet extends Command {
9
6
  async run() {
10
7
  const { flags } = await this.parse(ConfigSet);
11
- const config = path_1.default.join(this.config.configDir, 'config.json');
8
+ const config = path.join(this.config.configDir, 'config.json');
12
9
  if (!flags.hostname ||
13
10
  !flags.protocol ||
14
11
  !flags.port ||
@@ -16,7 +13,7 @@ class ConfigSet extends core_1.Command {
16
13
  !flags.password ||
17
14
  !flags.webdav ||
18
15
  !flags.group) {
19
- const res = await (0, enquirer_1.prompt)([
16
+ const res = await enquirer.prompt([
20
17
  {
21
18
  type: 'input',
22
19
  name: 'hostname',
@@ -63,6 +60,26 @@ class ConfigSet extends core_1.Command {
63
60
  message: 'What the default user group?',
64
61
  required: true,
65
62
  },
63
+ {
64
+ type: 'input',
65
+ name: 'deploymentSSHAccount',
66
+ message: 'Deployment SSH account'
67
+ },
68
+ {
69
+ type: 'password',
70
+ name: 'deploymentSSHPassword',
71
+ message: 'Deployment SSH password'
72
+ },
73
+ {
74
+ type: 'input',
75
+ name: 'gitRepository',
76
+ message: 'Release Git repository'
77
+ },
78
+ {
79
+ type: 'password',
80
+ name: 'gitToken',
81
+ message: 'Release Git token'
82
+ },
66
83
  ]);
67
84
  for (const key in res) {
68
85
  // eslint-disable-next-line no-prototype-builtins
@@ -73,8 +90,8 @@ class ConfigSet extends core_1.Command {
73
90
  }
74
91
  }
75
92
  }
76
- await fs_extra_1.default.ensureDir(this.config.configDir);
77
- await fs_extra_1.default.writeJson(config, {
93
+ await fs.ensureDir(this.config.configDir);
94
+ await fs.writeJson(config, {
78
95
  hostname: flags.hostname,
79
96
  protocol: flags.protocol,
80
97
  port: flags.port,
@@ -82,44 +99,44 @@ class ConfigSet extends core_1.Command {
82
99
  password: flags.password,
83
100
  webdav: flags.webdav,
84
101
  group: flags.group,
102
+ deploymentSSHAccount: flags.deploymentSSHAccount,
103
+ deploymentSSHPassword: flags.deploymentSSHPassword,
104
+ gitRepository: flags.gitRepository,
105
+ gitToken: flags.gitToken
85
106
  });
86
- // if (flags.json) {
87
- // this.log(JSON.stringify(await credentials(this)));
88
- // this.exit();
89
- // }
90
107
  this.log('Your LegisPro CLI configuration has been generated!');
91
108
  this.exit();
92
109
  }
93
110
  }
94
111
  ConfigSet.flags = {
95
- hostname: core_1.Flags.string({
112
+ hostname: Flags.string({
96
113
  description: 'Hostname',
97
114
  required: false,
98
115
  }),
99
- protocol: core_1.Flags.string({
116
+ protocol: Flags.string({
100
117
  description: 'Protocol',
101
118
  required: false,
102
119
  }),
103
- port: core_1.Flags.string({
120
+ port: Flags.string({
104
121
  description: 'Port',
105
122
  required: false,
106
123
  }),
107
- user: core_1.Flags.string({
124
+ user: Flags.string({
108
125
  description: 'Admin user',
109
126
  required: false,
110
127
  }),
111
- password: core_1.Flags.string({
128
+ password: Flags.string({
112
129
  description: 'Admin password',
113
130
  required: false,
114
131
  }),
115
- webdav: core_1.Flags.string({
132
+ webdav: Flags.string({
116
133
  description: 'WebDAV path',
117
134
  required: false,
118
135
  }),
119
- group: core_1.Flags.string({
136
+ group: Flags.string({
120
137
  description: 'User group',
121
138
  required: false,
122
139
  }),
123
140
  };
124
141
  ConfigSet.description = 'Sets your user configuration.';
125
- module.exports.ConfigSet = ConfigSet;
142
+ export default ConfigSet;
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const core_1 = require("@oclif/core");
5
- const utils_1 = require("../../lib/utils");
6
- const path_1 = tslib_1.__importDefault(require("path"));
7
- const add_1 = tslib_1.__importDefault(require("../locks/add"));
8
- class DbInit extends core_1.Command {
1
+ import { Command } from '@oclif/core';
2
+ import { client } from "../../lib/utils.js";
3
+ import path from "path";
4
+ import LocksAdd from "../locks/add.js";
5
+ class DbInit extends Command {
9
6
  async run() {
10
- const configFile = path_1.default.join(this.config.configDir, 'config.json');
7
+ const configFile = path.join(this.config.configDir, 'config.json');
11
8
  const env = require(configFile);
12
- utils_1.client.setConfig(this);
9
+ client.setConfig(this);
13
10
  // [1] create repository collection
14
- let collection_exists = await utils_1.client.existsCollection('/db/repository');
11
+ let collection_exists = await client.existsCollection('/db/repository');
15
12
  if (!collection_exists) {
16
13
  this.log("Creating /db/repository collection...");
17
14
  let collection = {
@@ -20,14 +17,14 @@ class DbInit extends core_1.Command {
20
17
  group: 'dba',
21
18
  mode: 'rwxr-xr-x',
22
19
  };
23
- let create_response = await utils_1.client.createCollection(collection);
24
- let modify_response = await utils_1.client.modifyCollection(collection);
20
+ let create_response = await client.createCollection(collection);
21
+ let modify_response = await client.modifyCollection(collection);
25
22
  }
26
23
  else {
27
24
  this.log("/db/repository already exists.");
28
25
  }
29
26
  // [2] create users group
30
- let res = await utils_1.client.getGroup('users');
27
+ let res = await client.getGroup('users');
31
28
  if (res.status != 200) {
32
29
  this.log("Creating users group...");
33
30
  let meta = [];
@@ -48,13 +45,13 @@ class DbInit extends core_1.Command {
48
45
  managers: ["admin"],
49
46
  metadata: meta,
50
47
  };
51
- let create_group_response = await utils_1.client.createGroup(users_group);
48
+ let create_group_response = await client.createGroup(users_group);
52
49
  }
53
50
  else {
54
51
  this.log("Users group already exists.");
55
52
  }
56
53
  // [3] create primary group
57
- let res_primary_group = await utils_1.client.getGroup(env.group);
54
+ let res_primary_group = await client.getGroup(env.group);
58
55
  if (res_primary_group.status != 200) {
59
56
  this.log("Creating primary group...");
60
57
  let meta = [];
@@ -75,16 +72,16 @@ class DbInit extends core_1.Command {
75
72
  managers: ["admin"],
76
73
  metadata: meta,
77
74
  };
78
- let create_primary_user_group_response = await utils_1.client.createGroup(primary_user_group);
75
+ let create_primary_user_group_response = await client.createGroup(primary_user_group);
79
76
  }
80
77
  else {
81
78
  this.log("Primary user group already exists.");
82
79
  }
83
80
  // [4] add locks
84
- await add_1.default.run();
81
+ await LocksAdd.run();
85
82
  this.exit();
86
83
  }
84
+ static description = "Initialize a new database";
85
+ static examples = [`$ legispro db:init`];
87
86
  }
88
- DbInit.description = "Initialize a new database";
89
- DbInit.examples = [`$ legispro db:init`];
90
- exports.default = DbInit;
87
+ export default DbInit;
@@ -1,13 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const utils_1 = require("../../lib/utils");
5
- class DbMemory extends core_1.Command {
1
+ import { Command } from '@oclif/core';
2
+ import { client } from "../../lib/utils.js";
3
+ class DbMemory extends Command {
6
4
  async run() {
7
- utils_1.client.setConfig(this);
8
- let mem_total_response = await utils_1.client.memoryTotal();
9
- let mem_max_response = await utils_1.client.memoryMax();
10
- let mem_free_response = await utils_1.client.memoryFree();
5
+ client.setConfig(this);
6
+ let mem_total_response = await client.memoryTotal();
7
+ let mem_max_response = await client.memoryMax();
8
+ let mem_free_response = await client.memoryFree();
11
9
  this.log(" Memory Status");
12
10
  this.log("================");
13
11
  if (mem_total_response.status == 200) {
@@ -21,7 +19,7 @@ class DbMemory extends core_1.Command {
21
19
  }
22
20
  this.exit();
23
21
  }
22
+ static description = "Database memory status";
23
+ static examples = [`$ legispro db:memory`,];
24
24
  }
25
- DbMemory.description = "Database memory status";
26
- DbMemory.examples = [`$ legispro db:memory`,];
27
- exports.default = DbMemory;
25
+ export default DbMemory;
@@ -1,17 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const utils_1 = require("../../lib/utils");
5
- class DbUptime extends core_1.Command {
1
+ import { Command } from '@oclif/core';
2
+ import { client } from "../../lib/utils.js";
3
+ class DbUptime extends Command {
6
4
  async run() {
7
- utils_1.client.setConfig(this);
8
- let response = await utils_1.client.uptime();
5
+ client.setConfig(this);
6
+ let response = await client.uptime();
9
7
  if (response.status == 200) {
10
8
  this.log(response.data.results);
11
9
  this.exit();
12
10
  }
13
11
  }
12
+ static description = "Get database uptime";
13
+ static examples = [`$ legispro db:uptime`,];
14
14
  }
15
- DbUptime.description = "Get database uptime";
16
- DbUptime.examples = [`$ legispro db:uptime`,];
17
- exports.default = DbUptime;
15
+ export default DbUptime;
@@ -1,17 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- const utils_1 = require("../../lib/utils");
5
- class DbVersion extends core_1.Command {
1
+ import { Command } from '@oclif/core';
2
+ import { client } from "../../lib/utils.js";
3
+ class DbVersion extends Command {
6
4
  async run() {
7
- utils_1.client.setConfig(this);
8
- let response = await utils_1.client.get("/version");
5
+ client.setConfig(this);
6
+ let response = await client.get("/version");
9
7
  if (response.status == 200) {
10
8
  this.log(JSON.stringify(response.data, null, 2));
11
9
  this.exit();
12
10
  }
13
11
  }
12
+ static description = "Get database version";
13
+ static examples = [`$ legispro db:version`,];
14
14
  }
15
- DbVersion.description = "Get database version";
16
- DbVersion.examples = [`$ legispro db:version`,];
17
- exports.default = DbVersion;
15
+ export default DbVersion;
@@ -0,0 +1,10 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class DeployPrepare extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ installationPath: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ env: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,130 @@
1
+ import { Command, Flags } from '@oclif/core';
2
+ import enquirer from 'enquirer';
3
+ import { connect, downloadAsset, listReleases } from '../../lib/gh.js';
4
+ import { copySources } from '../../lib/shell.js';
5
+ import { NodeSSH } from 'node-ssh';
6
+ import path from 'path';
7
+ import fs from 'fs-extra';
8
+ const ENV_OPTIONS = ['ola-dev', 'ola-qa', 'ola-linux-dev'];
9
+ export default class DeployPrepare extends Command {
10
+ static description = 'Executes a docker deployment';
11
+ static examples = [`<%= config.bin %> <%= command.id %>`];
12
+ static flags = {
13
+ installationPath: Flags.string({
14
+ description: 'Server installation path',
15
+ char: 'p',
16
+ default: 'C:/legispro/deploy/',
17
+ }),
18
+ env: Flags.string({
19
+ description: 'Environment variables file',
20
+ char: 'e',
21
+ options: ENV_OPTIONS
22
+ })
23
+ };
24
+ async run() {
25
+ const { flags } = await this.parse(DeployPrepare);
26
+ let env = {};
27
+ try {
28
+ const configFile = path.join(this.config.configDir, 'config.json');
29
+ env = JSON.parse(fs.readFileSync(configFile, 'utf-8'));
30
+ }
31
+ catch (error) {
32
+ /* Nothing to do */
33
+ env = {};
34
+ }
35
+ if (!env.gitToken || !env.gitRepository) {
36
+ const tokenPrompt = await enquirer.prompt([{
37
+ type: 'password',
38
+ name: 'gitToken',
39
+ message: 'Git token',
40
+ initial: env.gitToken,
41
+ required: true,
42
+ },
43
+ {
44
+ type: 'input',
45
+ name: 'gitRepository',
46
+ message: 'Git repository',
47
+ initial: env.gitRepository,
48
+ required: true
49
+ }]);
50
+ env.gitToken = tokenPrompt.gitToken;
51
+ env.gitRepository = tokenPrompt.gitRepository;
52
+ }
53
+ if (!env.deploymentSSHAccount || !env.deploymentSSHPassword) {
54
+ const tokenPrompt = await enquirer.prompt([{
55
+ type: 'input',
56
+ name: 'deploymentSSHAccount',
57
+ message: 'SSH account'
58
+ },
59
+ {
60
+ type: 'password',
61
+ name: 'deploymentSSHPassword',
62
+ message: 'SSH password'
63
+ }]);
64
+ env.deploymentSSHAccount = tokenPrompt.deploymentSSHAccount;
65
+ env.deploymentSSHPassword = tokenPrompt.deploymentSSHPassword;
66
+ }
67
+ if (!flags.env) {
68
+ const envPrompt = await enquirer.prompt({
69
+ type: 'select',
70
+ name: 'env',
71
+ message: 'Select your environment',
72
+ choices: ENV_OPTIONS
73
+ });
74
+ flags.env = envPrompt.env;
75
+ }
76
+ const oktokit = await connect(env.gitToken);
77
+ const { data, releases } = await listReleases(oktokit, env.gitRepository);
78
+ const { tag } = await enquirer.prompt({
79
+ type: 'select',
80
+ name: 'tag',
81
+ message: 'Select your tag',
82
+ choices: releases
83
+ });
84
+ let host1, host2;
85
+ switch (flags.env) {
86
+ case 'ola-dev':
87
+ host1 = 'legddocker01';
88
+ host2 = 'legddocker02';
89
+ break;
90
+ case 'ola-qa':
91
+ host1 = 'dpmsdocktest01';
92
+ host2 = 'dpmsdocktest02';
93
+ break;
94
+ case 'ola-linux-dev':
95
+ host1 = 'dpmsdockdev01';
96
+ host2 = 'dpmsdockdev02';
97
+ break;
98
+ }
99
+ const release = data.find(i => i.tag_name === tag);
100
+ const { sourcesDir, tmpPath } = await downloadAsset(oktokit, env.gitRepository, release);
101
+ console.log(`Extracting to ${sourcesDir}`);
102
+ const { localDir, cwd, scpPath, dockerCmdLegispro, dockerCmdDpms } = await copySources({ print: !env.deploymentSSHPassword, user: env.deploymentSSHAccount || 'USERNAME', tmpPath, sourcesDir, env: flags.env, installationFolder: flags.installationPath });
103
+ const ssh1 = new NodeSSH();
104
+ console.log('Connecting to server 01');
105
+ await ssh1.connect({ host: host1, username: env.deploymentSSHAccount, password: env.deploymentSSHPassword });
106
+ console.log('Make installation folder');
107
+ await ssh1.mkdir(scpPath);
108
+ console.log('Putting assets');
109
+ await ssh1.putDirectory(localDir, scpPath);
110
+ console.log('Docker compose up');
111
+ console.log(dockerCmdLegispro);
112
+ const { stdout: out1, stderr: err1 } = await ssh1.execCommand(`cd ${cwd} && ${dockerCmdLegispro}`);
113
+ console.log(out1);
114
+ console.error(err1);
115
+ const ssh2 = new NodeSSH();
116
+ console.log('Connecting to server 02');
117
+ await ssh2.connect({ host: host2, username: env.deploymentSSHAccount, password: env.deploymentSSHPassword });
118
+ console.log('Make installation folder');
119
+ await ssh2.mkdir(scpPath);
120
+ console.log('Putting assets');
121
+ await ssh2.putDirectory(localDir, scpPath);
122
+ console.log('Docker compose up');
123
+ console.log(dockerCmdDpms);
124
+ const { stdout: out2, stderr: err2 } = await ssh2.execCommand(`cd ${cwd} && ${dockerCmdDpms}`);
125
+ console.log(out2);
126
+ console.error(err2);
127
+ console.log(`Installation completed`);
128
+ process.exit(1);
129
+ }
130
+ }
@@ -1,26 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const core_1 = require("@oclif/core");
5
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
- const utils_1 = require("../../lib/utils");
7
- const path_1 = tslib_1.__importDefault(require("path"));
8
- const rclone = require("rclone.js").promises;
9
- class DocumentCopy extends core_1.Command {
1
+ import { Command } from '@oclif/core';
2
+ import chalk from "chalk";
3
+ import { client } from "../../lib/utils.js";
4
+ import path from "path";
5
+ import rclone from "rclone.js";
6
+ class DocumentCopy extends Command {
10
7
  async run() {
11
- const configFile = path_1.default.join(this.config.configDir, 'config.json');
8
+ const configFile = path.join(this.config.configDir, 'config.json');
12
9
  const env = require(configFile);
13
- utils_1.client.setConfig(this);
10
+ client.setConfig(this);
14
11
  let source = '/db/repository/demo';
15
12
  let dest = '/home/bmckinney/rclone-tests/demo';
16
13
  // check if source exists
17
- let exists = await utils_1.client.existsCollection(source);
14
+ let exists = await client.existsCollection(source);
18
15
  if (!exists) {
19
- this.log(`Collection: ${chalk_1.default.magenta("repository")} not found.`);
16
+ this.log(`Collection: ${chalk.magenta("repository")} not found.`);
20
17
  this.exit();
21
18
  }
22
- let obscured_password = await rclone.obscure(env.password);
23
- let copy_response = await rclone.copy(":webdav:" + source, dest, {
19
+ let obscured_password = await rclone.promises.obscure(env.password);
20
+ let copy_response = await rclone.promises.copy(":webdav:" + source, dest, {
24
21
  "webdav-url": env.protocol + "://" + env.hostname + ":" + env.port + "/exist/webdav/",
25
22
  "webdav-user": env.user,
26
23
  "webdav-pass": obscured_password
@@ -29,7 +26,7 @@ class DocumentCopy extends core_1.Command {
29
26
  //console.log(copy_response.toString());
30
27
  this.exit();
31
28
  }
29
+ static description = "List documents";
30
+ static examples = [`$ legispro document:list`,];
32
31
  }
33
- DocumentCopy.description = "List documents";
34
- DocumentCopy.examples = [`$ legispro document:list`,];
35
- exports.default = DocumentCopy;
32
+ export default DocumentCopy;
@@ -1,25 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const core_1 = require("@oclif/core");
5
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
- const utils_1 = require("../../lib/utils");
7
- const path_1 = tslib_1.__importDefault(require("path"));
8
- const rclone = require("rclone.js").promises;
9
- class DocumentList extends core_1.Command {
1
+ import { Command } from '@oclif/core';
2
+ import chalk from "chalk";
3
+ import { client } from "../../lib/utils.js";
4
+ import path from "path";
5
+ import rclone from "rclone.js";
6
+ class DocumentList extends Command {
10
7
  async run() {
11
- const configFile = path_1.default.join(this.config.configDir, 'config.json');
8
+ const configFile = path.join(this.config.configDir, 'config.json');
12
9
  const env = require(configFile);
13
- utils_1.client.setConfig(this);
10
+ client.setConfig(this);
14
11
  let uri = '/db/repository';
15
12
  // check if collection exists
16
- let exists = await utils_1.client.existsCollection(uri);
13
+ let exists = await client.existsCollection(uri);
17
14
  if (!exists) {
18
- this.log(`Collection: ${chalk_1.default.magenta("repository")} not found.`);
15
+ this.log(`Collection: ${chalk.magenta("repository")} not found.`);
19
16
  this.exit();
20
17
  }
21
- let obscured_password = await rclone.obscure(env.password);
22
- let list_response = await rclone.ls(":webdav:" + uri, {
18
+ let obscured_password = await rclone.promises.obscure(env.password);
19
+ let list_response = await rclone.promises.ls(":webdav:" + uri, {
23
20
  "webdav-url": env.protocol + "://" + env.hostname + ":" + env.port + "/exist/webdav/",
24
21
  "webdav-user": env.user,
25
22
  "webdav-pass": obscured_password,
@@ -28,7 +25,7 @@ class DocumentList extends core_1.Command {
28
25
  console.log(list_response.toString());
29
26
  this.exit();
30
27
  }
28
+ static description = "List documents";
29
+ static examples = [`$ legispro document:list`,];
31
30
  }
32
- DocumentList.description = "List documents";
33
- DocumentList.examples = [`$ legispro document:list`,];
34
- exports.default = DocumentList;
31
+ export default DocumentList;
@@ -2,11 +2,11 @@ import { Command } from '@oclif/core';
2
2
  declare class GroupCreate extends Command {
3
3
  run(): Promise<void>;
4
4
  static flags: {
5
- name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
6
- managers: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
- email: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
- language: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
- description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
5
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ managers: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ email: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ language: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
10
  };
11
11
  static description: string;
12
12
  static examples: string[];
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const core_1 = require("@oclif/core");
5
- const utils_1 = require("../../lib/utils");
6
- const enquirer_1 = require("enquirer");
7
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
- class GroupCreate extends core_1.Command {
1
+ import { Command, Flags } from '@oclif/core';
2
+ import { client } from "../../lib/utils.js";
3
+ import enquirer from 'enquirer';
4
+ import chalk from 'chalk';
5
+ class GroupCreate extends Command {
9
6
  async run() {
10
- utils_1.client.setConfig(this);
7
+ client.setConfig(this);
11
8
  const { flags } = await this.parse(GroupCreate);
12
9
  // prompts
13
10
  if (!flags.name) {
14
- const name_answer = await (0, enquirer_1.prompt)([
11
+ const name_answer = await enquirer.prompt([
15
12
  {
16
13
  type: 'input',
17
14
  name: 'name',
@@ -21,7 +18,7 @@ class GroupCreate extends core_1.Command {
21
18
  ]);
22
19
  // @ts-ignore
23
20
  flags.name = name_answer['name'];
24
- const res = await (0, enquirer_1.prompt)([
21
+ const res = await enquirer.prompt([
25
22
  {
26
23
  type: 'input',
27
24
  name: 'description',
@@ -88,45 +85,45 @@ class GroupCreate extends core_1.Command {
88
85
  managers: manager_list,
89
86
  metadata: meta,
90
87
  };
91
- let create_group_response = await utils_1.client.createGroup(group);
88
+ let create_group_response = await client.createGroup(group);
92
89
  // Spinner.stopAndPersist({
93
90
  // symbol: "✨",
94
91
  // text: `${chalk.bold(chalk.green('Group created'))}`
95
92
  // })
96
93
  if (create_group_response.status == 204) {
97
- this.log(`${chalk_1.default.bold.green('Group created')}`);
94
+ this.log(`${chalk.bold.green('Group created')}`);
98
95
  this.exit();
99
96
  }
100
97
  else {
101
- this.log(`${chalk_1.default.red("Error:")} (${create_group_response.status}) ${create_group_response.statusText}.`);
98
+ this.log(`${chalk.red("Error:")} (${create_group_response.status}) ${create_group_response.statusText}.`);
102
99
  // this.log(create_group_response);
103
100
  this.exit();
104
101
  }
105
102
  }
106
103
  }
104
+ static flags = {
105
+ name: Flags.string({
106
+ description: 'Name',
107
+ required: false
108
+ }),
109
+ managers: Flags.string({
110
+ description: 'Managers',
111
+ required: false
112
+ }),
113
+ email: Flags.string({
114
+ description: 'email',
115
+ required: false
116
+ }),
117
+ language: Flags.string({
118
+ description: 'language',
119
+ required: false
120
+ }),
121
+ description: Flags.string({
122
+ description: 'description',
123
+ required: false
124
+ }),
125
+ };
126
+ static description = "Create group";
127
+ static examples = [`$ legispro groupr:create`,];
107
128
  }
108
- GroupCreate.flags = {
109
- name: core_1.Flags.string({
110
- description: 'Name',
111
- required: false
112
- }),
113
- managers: core_1.Flags.string({
114
- description: 'Managers',
115
- required: false
116
- }),
117
- email: core_1.Flags.string({
118
- description: 'email',
119
- required: false
120
- }),
121
- language: core_1.Flags.string({
122
- description: 'language',
123
- required: false
124
- }),
125
- description: core_1.Flags.string({
126
- description: 'description',
127
- required: false
128
- }),
129
- };
130
- GroupCreate.description = "Create group";
131
- GroupCreate.examples = [`$ legispro groupr:create`,];
132
- exports.default = GroupCreate;
129
+ export default GroupCreate;