legispro-cli 1.0.7 → 1.0.8
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/LICENSE +21 -21
- package/README.md +45 -17
- package/bin/dev.cmd +3 -3
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -3
- package/bin/run.js +5 -0
- package/dist/commands/backup/create.js +13 -16
- package/dist/commands/backup/list.js +15 -18
- package/dist/commands/collection/add.d.ts +3 -3
- package/dist/commands/collection/add.js +31 -34
- package/dist/commands/collection/create.d.ts +5 -5
- package/dist/commands/collection/create.js +46 -49
- package/dist/commands/collection/delete.d.ts +1 -1
- package/dist/commands/collection/delete.js +20 -23
- package/dist/commands/collection/download.d.ts +2 -2
- package/dist/commands/collection/download.js +28 -31
- package/dist/commands/collection/get.d.ts +1 -1
- package/dist/commands/collection/get.js +21 -24
- package/dist/commands/collection/list.js +13 -16
- package/dist/commands/collection/perms.d.ts +3 -3
- package/dist/commands/collection/perms.js +29 -32
- package/dist/commands/collection/update.d.ts +7 -7
- package/dist/commands/collection/update.js +50 -54
- package/dist/commands/collection/upload.d.ts +3 -3
- package/dist/commands/collection/upload.js +39 -42
- package/dist/commands/config/get.d.ts +5 -1
- package/dist/commands/config/get.js +7 -10
- package/dist/commands/config/set.d.ts +5 -1
- package/dist/commands/config/set.js +41 -24
- package/dist/commands/db/init.js +18 -21
- package/dist/commands/db/memory.js +10 -12
- package/dist/commands/db/uptime.js +8 -10
- package/dist/commands/db/version.js +8 -10
- package/dist/commands/deploy/index.d.ts +10 -0
- package/dist/commands/deploy/index.js +126 -0
- package/dist/commands/document/copy.js +15 -18
- package/dist/commands/document/list.js +15 -18
- package/dist/commands/group/create.d.ts +5 -5
- package/dist/commands/group/create.js +36 -39
- package/dist/commands/group/delete.d.ts +1 -1
- package/dist/commands/group/delete.js +19 -22
- package/dist/commands/group/get.d.ts +1 -1
- package/dist/commands/group/get.js +20 -23
- package/dist/commands/group/list.js +8 -10
- package/dist/commands/group/update.d.ts +5 -5
- package/dist/commands/group/update.js +36 -39
- package/dist/commands/locks/add.js +16 -18
- package/dist/commands/locks/clear.js +11 -13
- package/dist/commands/services/health.js +11 -14
- package/dist/commands/user/create.d.ts +17 -17
- package/dist/commands/user/create.js +104 -107
- package/dist/commands/user/delete.d.ts +1 -1
- package/dist/commands/user/delete.js +24 -27
- package/dist/commands/user/get.d.ts +1 -1
- package/dist/commands/user/get.js +20 -23
- package/dist/commands/user/list.js +10 -13
- package/dist/commands/user/login.d.ts +2 -2
- package/dist/commands/user/login.js +30 -33
- package/dist/commands/user/update.d.ts +16 -16
- package/dist/commands/user/update.js +108 -111
- package/dist/index.js +1 -5
- package/dist/lib/fusiondb-client.d.ts +2 -1
- package/dist/lib/fusiondb-client.js +19 -18
- package/dist/lib/gh.d.ts +26 -0
- package/dist/lib/gh.js +37 -0
- package/dist/lib/rclone-client.js +12 -15
- package/dist/lib/shell.d.ts +24 -0
- package/dist/lib/shell.js +68 -0
- package/dist/lib/types.js +1 -2
- package/dist/lib/utils.d.ts +2 -2
- package/dist/lib/utils.js +4 -7
- package/dist/lib/xml-templates.js +61 -65
- package/oclif.manifest.json +958 -520
- package/package.json +102 -98
- package/bin/dev +0 -17
- package/bin/run +0 -5
- package/dist/commands/locks/list.d.ts +0 -7
- package/dist/commands/locks/list.js +0 -86
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Salesforce
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Salesforce
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ LegisPro CLI - test
|
|
|
13
13
|
* [Usage](#usage)
|
|
14
14
|
* [Commands](#commands)
|
|
15
15
|
<!-- tocstop -->
|
|
16
|
+
|
|
16
17
|
# Usage
|
|
17
18
|
<!-- usage -->
|
|
18
19
|
```sh-session
|
|
@@ -20,13 +21,14 @@ $ npm install -g legispro-cli
|
|
|
20
21
|
$ lp COMMAND
|
|
21
22
|
running command...
|
|
22
23
|
$ lp (--version)
|
|
23
|
-
legispro-cli/1.0.
|
|
24
|
+
legispro-cli/1.0.8 win32-x64 node-v20.18.3
|
|
24
25
|
$ lp --help [COMMAND]
|
|
25
26
|
USAGE
|
|
26
27
|
$ lp COMMAND
|
|
27
28
|
...
|
|
28
29
|
```
|
|
29
30
|
<!-- usagestop -->
|
|
31
|
+
|
|
30
32
|
# Commands
|
|
31
33
|
<!-- commands -->
|
|
32
34
|
* [`lp backup create`](#lp-backup-create)
|
|
@@ -46,6 +48,7 @@ USAGE
|
|
|
46
48
|
* [`lp db memory`](#lp-db-memory)
|
|
47
49
|
* [`lp db uptime`](#lp-db-uptime)
|
|
48
50
|
* [`lp db version`](#lp-db-version)
|
|
51
|
+
* [`lp deploy`](#lp-deploy)
|
|
49
52
|
* [`lp document copy`](#lp-document-copy)
|
|
50
53
|
* [`lp document list`](#lp-document-list)
|
|
51
54
|
* [`lp group create`](#lp-group-create)
|
|
@@ -53,9 +56,9 @@ USAGE
|
|
|
53
56
|
* [`lp group get`](#lp-group-get)
|
|
54
57
|
* [`lp group list`](#lp-group-list)
|
|
55
58
|
* [`lp group update`](#lp-group-update)
|
|
59
|
+
* [`lp help [COMMAND]`](#lp-help-command)
|
|
56
60
|
* [`lp locks add`](#lp-locks-add)
|
|
57
61
|
* [`lp locks clear`](#lp-locks-clear)
|
|
58
|
-
* [`lp locks list`](#lp-locks-list)
|
|
59
62
|
* [`lp services health`](#lp-services-health)
|
|
60
63
|
* [`lp user create`](#lp-user-create)
|
|
61
64
|
* [`lp user delete`](#lp-user-delete)
|
|
@@ -365,6 +368,26 @@ EXAMPLES
|
|
|
365
368
|
$ legispro db:version
|
|
366
369
|
```
|
|
367
370
|
|
|
371
|
+
## `lp deploy`
|
|
372
|
+
|
|
373
|
+
Executes a docker deployment
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
USAGE
|
|
377
|
+
$ lp deploy [-p <value>] [-e ola-dev|ola-qa]
|
|
378
|
+
|
|
379
|
+
FLAGS
|
|
380
|
+
-e, --env=<option> Environment variables file
|
|
381
|
+
<options: ola-dev|ola-qa>
|
|
382
|
+
-p, --installationPath=<value> [default: C:/legispro/deploy/] Server installation path
|
|
383
|
+
|
|
384
|
+
DESCRIPTION
|
|
385
|
+
Executes a docker deployment
|
|
386
|
+
|
|
387
|
+
EXAMPLES
|
|
388
|
+
$ lp deploy
|
|
389
|
+
```
|
|
390
|
+
|
|
368
391
|
## `lp document copy`
|
|
369
392
|
|
|
370
393
|
List documents
|
|
@@ -492,6 +515,26 @@ EXAMPLES
|
|
|
492
515
|
$ legispro groupr:create
|
|
493
516
|
```
|
|
494
517
|
|
|
518
|
+
## `lp help [COMMAND]`
|
|
519
|
+
|
|
520
|
+
Display help for lp.
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
USAGE
|
|
524
|
+
$ lp help [COMMAND...] [-n]
|
|
525
|
+
|
|
526
|
+
ARGUMENTS
|
|
527
|
+
COMMAND... Command to show help for.
|
|
528
|
+
|
|
529
|
+
FLAGS
|
|
530
|
+
-n, --nested-commands Include all nested commands in the output.
|
|
531
|
+
|
|
532
|
+
DESCRIPTION
|
|
533
|
+
Display help for lp.
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.26/src/commands/help.ts)_
|
|
537
|
+
|
|
495
538
|
## `lp locks add`
|
|
496
539
|
|
|
497
540
|
Add Locks and Mods XML files
|
|
@@ -522,21 +565,6 @@ EXAMPLES
|
|
|
522
565
|
$ legispro locks:clear
|
|
523
566
|
```
|
|
524
567
|
|
|
525
|
-
## `lp locks list`
|
|
526
|
-
|
|
527
|
-
List active and expired locks
|
|
528
|
-
|
|
529
|
-
```
|
|
530
|
-
USAGE
|
|
531
|
-
$ lp locks list
|
|
532
|
-
|
|
533
|
-
DESCRIPTION
|
|
534
|
-
List active and expired locks
|
|
535
|
-
|
|
536
|
-
EXAMPLES
|
|
537
|
-
$ legispro locks:list
|
|
538
|
-
```
|
|
539
|
-
|
|
540
568
|
## `lp services health`
|
|
541
569
|
|
|
542
570
|
Perform services health check
|
package/bin/dev.cmd
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
|
|
3
|
-
node "%~dp0\dev" %*
|
|
1
|
+
@echo off
|
|
2
|
+
|
|
3
|
+
node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
|
package/bin/dev.js
ADDED
package/bin/run.cmd
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
|
|
3
|
-
node "%~dp0\run" %*
|
|
1
|
+
@echo off
|
|
2
|
+
|
|
3
|
+
node "%~dp0\run" %*
|
package/bin/run.js
ADDED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
7
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
-
class BackupCreate extends core_1.Command {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { client } from '../../lib/utils.js';
|
|
3
|
+
import ora from "ora";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
class BackupCreate extends Command {
|
|
9
6
|
async run() {
|
|
10
|
-
|
|
11
|
-
const Spinner = (
|
|
12
|
-
text: `${
|
|
7
|
+
client.setConfig(this);
|
|
8
|
+
const Spinner = ora({
|
|
9
|
+
text: `${chalk.bold.blue('Creating backup...')}`
|
|
13
10
|
}).start();
|
|
14
|
-
let response = await
|
|
11
|
+
let response = await client.backupDatabase();
|
|
15
12
|
if (response.status == 200) {
|
|
16
13
|
Spinner.stopAndPersist({
|
|
17
14
|
symbol: "✨",
|
|
18
|
-
text: `${
|
|
15
|
+
text: `${chalk.bold.green('Backup complete!')}`
|
|
19
16
|
});
|
|
20
17
|
this.exit();
|
|
21
18
|
}
|
|
22
19
|
}
|
|
20
|
+
static description = "Create a database backup";
|
|
21
|
+
static examples = [`$ legispro backup:create`,];
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
BackupCreate.examples = [`$ legispro backup:create`,];
|
|
26
|
-
exports.default = BackupCreate;
|
|
23
|
+
export default BackupCreate;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const xml2js = require('xml2js');
|
|
9
|
-
const stripNS = require('xml2js').processors.stripPrefix;
|
|
10
|
-
class BackupList extends core_1.Command {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { client } from "../../lib/utils.js";
|
|
3
|
+
import ora from "ora";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import xml2js from 'xml2js';
|
|
6
|
+
const stripNS = xml2js.processors.stripPrefix;
|
|
7
|
+
class BackupList extends Command {
|
|
11
8
|
async run() {
|
|
12
|
-
|
|
13
|
-
const Spinner = (
|
|
14
|
-
text: `${
|
|
9
|
+
client.setConfig(this);
|
|
10
|
+
const Spinner = ora({
|
|
11
|
+
text: `${chalk.bold.blue('Looking for backups...')}`
|
|
15
12
|
}).start();
|
|
16
|
-
let response = await
|
|
13
|
+
let response = await client.listBackups();
|
|
17
14
|
if (response.status == 200) {
|
|
18
15
|
// convert xml response to json
|
|
19
16
|
xml2js.parseString(response.data.results, { mergeAttrs: true,
|
|
@@ -27,12 +24,12 @@ class BackupList extends core_1.Command {
|
|
|
27
24
|
});
|
|
28
25
|
Spinner.stopAndPersist({
|
|
29
26
|
symbol: "✨",
|
|
30
|
-
text: `${
|
|
27
|
+
text: `${chalk.bold.green('Done')}`
|
|
31
28
|
});
|
|
32
29
|
this.exit();
|
|
33
30
|
}
|
|
34
31
|
}
|
|
32
|
+
static description = "List all database backups";
|
|
33
|
+
static examples = [`$ legispro backup:list`,];
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
BackupList.examples = [`$ legispro backup:list`,];
|
|
38
|
-
exports.default = BackupList;
|
|
35
|
+
export default BackupList;
|
|
@@ -2,9 +2,9 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
declare class CollectionAdd extends Command {
|
|
3
3
|
run(): Promise<void>;
|
|
4
4
|
static flags: {
|
|
5
|
-
name: import("@oclif/core/
|
|
6
|
-
file: import("@oclif/core/
|
|
7
|
-
mediaType: import("@oclif/core/
|
|
5
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
mediaType: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
};
|
|
9
9
|
static description: string;
|
|
10
10
|
static examples: string[];
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const enquirer_1 = require("enquirer");
|
|
8
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
-
class CollectionAdd extends core_1.Command {
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { client } from "../../lib/utils.js";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import enquirer from "enquirer";
|
|
5
|
+
import path from "path";
|
|
6
|
+
class CollectionAdd extends Command {
|
|
10
7
|
async run() {
|
|
11
|
-
const configFile =
|
|
8
|
+
const configFile = path.join(this.config.configDir, 'config.json');
|
|
12
9
|
const env = require(configFile);
|
|
13
|
-
|
|
10
|
+
client.setConfig(this);
|
|
14
11
|
const { flags } = await this.parse(CollectionAdd);
|
|
15
12
|
let modes = {
|
|
16
13
|
"shared": 'rwxrwsr-T',
|
|
@@ -21,7 +18,7 @@ class CollectionAdd extends core_1.Command {
|
|
|
21
18
|
let collection_uri = '';
|
|
22
19
|
let collection_type = 'user';
|
|
23
20
|
if (Object.keys(flags).length == 0) {
|
|
24
|
-
const res = await
|
|
21
|
+
const res = await enquirer.prompt([
|
|
25
22
|
{
|
|
26
23
|
type: 'input',
|
|
27
24
|
name: 'name',
|
|
@@ -53,13 +50,13 @@ class CollectionAdd extends core_1.Command {
|
|
|
53
50
|
if (flags.name && flags.file && flags.mediaType) {
|
|
54
51
|
collection_uri = '/db/repository/' + flags.name;
|
|
55
52
|
// check if collection exists
|
|
56
|
-
let exists = await
|
|
53
|
+
let exists = await client.existsCollection(collection_uri);
|
|
57
54
|
if (!exists) {
|
|
58
|
-
this.log(`Collection: ${
|
|
55
|
+
this.log(`Collection: ${chalk.magenta(flags.name)} not found.`);
|
|
59
56
|
this.exit();
|
|
60
57
|
}
|
|
61
58
|
// determine collection type so you can apply the correct mode
|
|
62
|
-
projectObject = await
|
|
59
|
+
projectObject = await client.getCollectionProject(collection_uri);
|
|
63
60
|
if (projectObject != null) {
|
|
64
61
|
collection_type = projectObject.type;
|
|
65
62
|
}
|
|
@@ -75,9 +72,9 @@ class CollectionAdd extends core_1.Command {
|
|
|
75
72
|
group: env.group,
|
|
76
73
|
mode: modes[collection_type]
|
|
77
74
|
};
|
|
78
|
-
let response = await
|
|
75
|
+
let response = await client.createDocument(collection_uri + "/" + file, buffer);
|
|
79
76
|
if (response.status == 201) {
|
|
80
|
-
let update_doc_props_response = await
|
|
77
|
+
let update_doc_props_response = await client.updateDocumentProperties(document);
|
|
81
78
|
//console.log(update_doc_props_response);
|
|
82
79
|
this.log("File added: " + flags.file);
|
|
83
80
|
this.exit();
|
|
@@ -88,21 +85,21 @@ class CollectionAdd extends core_1.Command {
|
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
}
|
|
88
|
+
static flags = {
|
|
89
|
+
name: Flags.string({
|
|
90
|
+
description: 'Name',
|
|
91
|
+
required: false
|
|
92
|
+
}),
|
|
93
|
+
file: Flags.string({
|
|
94
|
+
description: 'File',
|
|
95
|
+
required: false
|
|
96
|
+
}),
|
|
97
|
+
mediaType: Flags.string({
|
|
98
|
+
description: 'Media type',
|
|
99
|
+
required: false
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
102
|
+
static description = "Add document to collection";
|
|
103
|
+
static examples = [`$ legispro collection:add`,];
|
|
91
104
|
}
|
|
92
|
-
|
|
93
|
-
name: core_1.Flags.string({
|
|
94
|
-
description: 'Name',
|
|
95
|
-
required: false
|
|
96
|
-
}),
|
|
97
|
-
file: core_1.Flags.string({
|
|
98
|
-
description: 'File',
|
|
99
|
-
required: false
|
|
100
|
-
}),
|
|
101
|
-
mediaType: core_1.Flags.string({
|
|
102
|
-
description: 'Media type',
|
|
103
|
-
required: false
|
|
104
|
-
}),
|
|
105
|
-
};
|
|
106
|
-
CollectionAdd.description = "Add document to collection";
|
|
107
|
-
CollectionAdd.examples = [`$ legispro collection:add`,];
|
|
108
|
-
exports.default = CollectionAdd;
|
|
105
|
+
export default CollectionAdd;
|
|
@@ -2,11 +2,11 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
declare class CollectionCreate extends Command {
|
|
3
3
|
run(): Promise<void>;
|
|
4
4
|
static flags: {
|
|
5
|
-
name: import("@oclif/core/
|
|
6
|
-
title: import("@oclif/core/
|
|
7
|
-
baseURI: import("@oclif/core/
|
|
8
|
-
defaultExt: import("@oclif/core/
|
|
9
|
-
type: import("@oclif/core/
|
|
5
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
title: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
baseURI: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
defaultExt: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
type: 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,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
-
const treeify = require('treeify');
|
|
9
|
-
class CollectionCreate 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 path from "path";
|
|
5
|
+
import treeify from 'treeify';
|
|
6
|
+
class CollectionCreate extends Command {
|
|
10
7
|
async run() {
|
|
11
|
-
const configFile =
|
|
8
|
+
const configFile = path.join(this.config.configDir, 'config.json');
|
|
12
9
|
const env = require(configFile);
|
|
13
|
-
|
|
10
|
+
client.setConfig(this);
|
|
14
11
|
const { flags } = await this.parse(CollectionCreate);
|
|
15
12
|
// prompts
|
|
16
13
|
if (Object.keys(flags).length == 0) {
|
|
17
|
-
const res = await
|
|
14
|
+
const res = await enquirer.prompt([
|
|
18
15
|
{
|
|
19
16
|
type: 'input',
|
|
20
17
|
name: 'name',
|
|
@@ -74,17 +71,17 @@ class CollectionCreate extends core_1.Command {
|
|
|
74
71
|
mode: mode,
|
|
75
72
|
};
|
|
76
73
|
// 1. Create collection
|
|
77
|
-
let create_response = await
|
|
78
|
-
let modify_response = await
|
|
74
|
+
let create_response = await client.createCollection(collection);
|
|
75
|
+
let modify_response = await client.modifyCollection(collection);
|
|
79
76
|
// 2. Add a .project.xml file to it
|
|
80
77
|
let project_uri = '/db/repository/' + flags.name + '/.project.xml';
|
|
81
78
|
let project_xml_mode = 'rw-r--r--';
|
|
82
|
-
let projectXml = `<project xmlns="http://www.xcential.com/schemas/docs">
|
|
83
|
-
<name>${flags.name}</name>
|
|
84
|
-
<title>${flags.title}</title>
|
|
85
|
-
<baseURI>${flags.baseURI}</baseURI>
|
|
86
|
-
<defaultExt>${flags.defaultExt}</defaultExt>
|
|
87
|
-
<type>${flags.type}</type>
|
|
79
|
+
let projectXml = `<project xmlns="http://www.xcential.com/schemas/docs">
|
|
80
|
+
<name>${flags.name}</name>
|
|
81
|
+
<title>${flags.title}</title>
|
|
82
|
+
<baseURI>${flags.baseURI}</baseURI>
|
|
83
|
+
<defaultExt>${flags.defaultExt}</defaultExt>
|
|
84
|
+
<type>${flags.type}</type>
|
|
88
85
|
</project>`;
|
|
89
86
|
const buffer = Buffer.from(projectXml, "utf-8");
|
|
90
87
|
let project_xml_document = {
|
|
@@ -95,38 +92,38 @@ class CollectionCreate extends core_1.Command {
|
|
|
95
92
|
group: env.group,
|
|
96
93
|
mode: project_xml_mode
|
|
97
94
|
};
|
|
98
|
-
let project_xml_response = await
|
|
99
|
-
let update_doc_props_response = await
|
|
100
|
-
let list_response = await
|
|
101
|
-
this.log(treeify.asTree(list_response, true));
|
|
95
|
+
let project_xml_response = await client.createDocument(project_uri, buffer);
|
|
96
|
+
let update_doc_props_response = await client.updateDocumentProperties(project_xml_document);
|
|
97
|
+
let list_response = await client.getCollection(collection.uri);
|
|
98
|
+
this.log(treeify.asTree(list_response, true, false));
|
|
102
99
|
if (list_response.status == 200) {
|
|
103
100
|
this.log(`Collection: ${flags.name} created`);
|
|
104
101
|
}
|
|
105
102
|
this.exit();
|
|
106
103
|
}
|
|
104
|
+
static flags = {
|
|
105
|
+
name: Flags.string({
|
|
106
|
+
description: 'Name',
|
|
107
|
+
required: false
|
|
108
|
+
}),
|
|
109
|
+
title: Flags.string({
|
|
110
|
+
description: 'Title',
|
|
111
|
+
required: false
|
|
112
|
+
}),
|
|
113
|
+
baseURI: Flags.string({
|
|
114
|
+
description: 'Base URI',
|
|
115
|
+
required: false
|
|
116
|
+
}),
|
|
117
|
+
defaultExt: Flags.string({
|
|
118
|
+
description: 'Default extension',
|
|
119
|
+
required: false
|
|
120
|
+
}),
|
|
121
|
+
type: Flags.string({
|
|
122
|
+
description: 'Collection type',
|
|
123
|
+
required: false
|
|
124
|
+
}),
|
|
125
|
+
};
|
|
126
|
+
static description = "Create a collection";
|
|
127
|
+
static examples = [`$ legispro collection:create`,];
|
|
107
128
|
}
|
|
108
|
-
|
|
109
|
-
name: core_1.Flags.string({
|
|
110
|
-
description: 'Name',
|
|
111
|
-
required: false
|
|
112
|
-
}),
|
|
113
|
-
title: core_1.Flags.string({
|
|
114
|
-
description: 'Title',
|
|
115
|
-
required: false
|
|
116
|
-
}),
|
|
117
|
-
baseURI: core_1.Flags.string({
|
|
118
|
-
description: 'Base URI',
|
|
119
|
-
required: false
|
|
120
|
-
}),
|
|
121
|
-
defaultExt: core_1.Flags.string({
|
|
122
|
-
description: 'Default extension',
|
|
123
|
-
required: false
|
|
124
|
-
}),
|
|
125
|
-
type: core_1.Flags.string({
|
|
126
|
-
description: 'Collection type',
|
|
127
|
-
required: false
|
|
128
|
-
}),
|
|
129
|
-
};
|
|
130
|
-
CollectionCreate.description = "Create a collection";
|
|
131
|
-
CollectionCreate.examples = [`$ legispro collection:create`,];
|
|
132
|
-
exports.default = CollectionCreate;
|
|
129
|
+
export default CollectionCreate;
|
|
@@ -2,7 +2,7 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
declare class CollectionDelete extends Command {
|
|
3
3
|
run(): Promise<void>;
|
|
4
4
|
static flags: {
|
|
5
|
-
name: import("@oclif/core/
|
|
5
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
6
|
};
|
|
7
7
|
static description: string;
|
|
8
8
|
static examples: string[];
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const enquirer_1 = require("enquirer");
|
|
7
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
-
class CollectionDelete 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 CollectionDelete extends Command {
|
|
9
6
|
async run() {
|
|
10
|
-
|
|
7
|
+
client.setConfig(this);
|
|
11
8
|
const { flags } = await this.parse(CollectionDelete);
|
|
12
9
|
// prompts
|
|
13
10
|
if (Object.keys(flags).length == 0) {
|
|
14
|
-
const res = await
|
|
11
|
+
const res = await enquirer.prompt([
|
|
15
12
|
{
|
|
16
13
|
type: 'input',
|
|
17
14
|
name: 'name',
|
|
@@ -29,25 +26,25 @@ class CollectionDelete extends core_1.Command {
|
|
|
29
26
|
if (flags.name) {
|
|
30
27
|
let collection_uri = '/db/repository/' + flags.name;
|
|
31
28
|
// check if collection exists
|
|
32
|
-
let exists = await
|
|
29
|
+
let exists = await client.existsCollection(collection_uri);
|
|
33
30
|
if (!exists) {
|
|
34
|
-
this.log(`Collection: ${
|
|
31
|
+
this.log(`Collection: ${chalk.magenta(flags.name)} not found.`);
|
|
35
32
|
this.exit();
|
|
36
33
|
}
|
|
37
|
-
let response = await
|
|
34
|
+
let response = await client.deleteCollection(collection_uri);
|
|
38
35
|
if (response.status == 204) {
|
|
39
|
-
this.log(`Collection: ${
|
|
36
|
+
this.log(`Collection: ${chalk.magenta(flags.name)} deleted.`);
|
|
40
37
|
this.exit();
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
}
|
|
41
|
+
static flags = {
|
|
42
|
+
name: Flags.string({
|
|
43
|
+
description: 'Name',
|
|
44
|
+
required: false
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
static description = "Delete a collection";
|
|
48
|
+
static examples = [`$ legispro collection:delete`,];
|
|
44
49
|
}
|
|
45
|
-
|
|
46
|
-
name: core_1.Flags.string({
|
|
47
|
-
description: 'Name',
|
|
48
|
-
required: false
|
|
49
|
-
}),
|
|
50
|
-
};
|
|
51
|
-
CollectionDelete.description = "Delete a collection";
|
|
52
|
-
CollectionDelete.examples = [`$ legispro collection:delete`,];
|
|
53
|
-
exports.default = CollectionDelete;
|
|
50
|
+
export default CollectionDelete;
|
|
@@ -2,8 +2,8 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
declare class CollectionDownload extends Command {
|
|
3
3
|
run(): Promise<void>;
|
|
4
4
|
static flags: {
|
|
5
|
-
name: import("@oclif/core/
|
|
6
|
-
dest: import("@oclif/core/
|
|
5
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
dest: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
};
|
|
8
8
|
static description: string;
|
|
9
9
|
static examples: string[];
|