@contentstack/cli-utilities 1.3.2 → 1.4.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/lib/cli-ux.js +11 -0
- package/lib/config-handler.js +2 -1
- package/package.json +5 -4
- package/types/auth-handler.d.ts +0 -0
- package/types/cli-ux.d.ts +20 -14
- package/types/contentstack-management-sdk.d.ts +5 -5
- package/types/helpers.d.ts +1 -1
- package/types/http-client/client.d.ts +3 -0
- package/types/interfaces/index.d.ts +34 -31
package/lib/cli-ux.js
CHANGED
|
@@ -8,7 +8,9 @@ const core_1 = require("@oclif/core");
|
|
|
8
8
|
Object.defineProperty(exports, "Args", { enumerable: true, get: function () { return core_1.Args; } });
|
|
9
9
|
Object.defineProperty(exports, "Flags", { enumerable: true, get: function () { return core_1.Flags; } });
|
|
10
10
|
Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return core_1.Command; } });
|
|
11
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
11
12
|
const message_handler_1 = tslib_1.__importDefault(require("./message-handler"));
|
|
13
|
+
inquirer_1.default.registerPrompt('table', require('inquirer-table-prompt'));
|
|
12
14
|
/**
|
|
13
15
|
* CLI Interface
|
|
14
16
|
*/
|
|
@@ -73,5 +75,14 @@ class CLIInterface {
|
|
|
73
75
|
progress(options) {
|
|
74
76
|
return core_1.ux.progress(options);
|
|
75
77
|
}
|
|
78
|
+
loaderV2(message = '', spinner) {
|
|
79
|
+
if (!spinner) {
|
|
80
|
+
return (0, ora_1.default)(message).start();
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
spinner.text = message;
|
|
84
|
+
spinner.stop();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
76
87
|
}
|
|
77
88
|
exports.default = new CLIInterface();
|
package/lib/config-handler.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const conf_1 = tslib_1.__importDefault(require("conf"));
|
|
5
|
+
const has_1 = tslib_1.__importDefault(require("lodash/has"));
|
|
5
6
|
const uuid_1 = require("uuid");
|
|
6
7
|
const fs_1 = require("fs");
|
|
7
8
|
const ENC_KEY = process.env.ENC_KEY || 'encryptionKey';
|
|
8
|
-
const ENCRYPT_CONF = process.env.ENCRYPT_CONF === 'true'
|
|
9
|
+
const ENCRYPT_CONF = (0, has_1.default)(process.env, 'ENCRYPT_CONF') ? process.env.ENCRYPT_CONF === 'true' : true;
|
|
9
10
|
const CONFIG_NAME = process.env.CONFIG_NAME || 'contentstack_cli';
|
|
10
11
|
const ENC_CONFIG_NAME = process.env.ENC_CONFIG_NAME || 'contentstack_cli_obfuscate';
|
|
11
12
|
const OLD_CONFIG_BACKUP_FLAG = 'isOldConfigBackup';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-utilities",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Utilities for contentstack projects",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"author": "contentstack",
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@contentstack/management": "^1.
|
|
35
|
-
"@oclif/core": "^2.
|
|
34
|
+
"@contentstack/management": "^1.8.0",
|
|
35
|
+
"@oclif/core": "^2.8.2",
|
|
36
36
|
"axios": "1.3.4",
|
|
37
37
|
"chalk": "^4.0.0",
|
|
38
38
|
"conf": "^10.1.2",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"inquirer": "8.2.4",
|
|
41
41
|
"inquirer-search-checkbox": "^1.0.0",
|
|
42
42
|
"inquirer-search-list": "^1.2.6",
|
|
43
|
+
"inquirer-table-prompt": "git@github.com:kego1992/inquirer-table-prompt.git",
|
|
43
44
|
"lodash": "^4.17.15",
|
|
44
45
|
"open": "^8.4.2",
|
|
45
46
|
"ora": "^5.4.0",
|
|
@@ -72,4 +73,4 @@
|
|
|
72
73
|
"tslib": "^1.13.0",
|
|
73
74
|
"typescript": "^4.9.3"
|
|
74
75
|
}
|
|
75
|
-
}
|
|
76
|
+
}
|
package/types/auth-handler.d.ts
CHANGED
|
File without changes
|
package/types/cli-ux.d.ts
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import { Table } from '@oclif/core/lib/cli-ux';
|
|
2
2
|
import { Args, Flags, Command } from '@oclif/core';
|
|
3
|
+
import { Ora } from 'ora';
|
|
3
4
|
import { PrintOptions, InquirePayload, CliUXPromptOptions } from './interfaces';
|
|
4
5
|
/**
|
|
5
6
|
* CLI Interface
|
|
6
7
|
*/
|
|
7
8
|
declare class CLIInterface {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
private loading;
|
|
10
|
+
constructor();
|
|
11
|
+
get uxTable(): typeof Table.table;
|
|
12
|
+
init(context: any): void;
|
|
13
|
+
registerSearchPlugin(): void;
|
|
14
|
+
print(message: string, opts?: PrintOptions): void;
|
|
15
|
+
success(message: string): void;
|
|
16
|
+
error(message: string, ...params: any): void;
|
|
17
|
+
loader(message?: string): void;
|
|
18
|
+
table(
|
|
19
|
+
data: Record<string, unknown>[],
|
|
20
|
+
columns: Table.table.Columns<Record<string, unknown>>,
|
|
21
|
+
options?: Table.table.Options,
|
|
22
|
+
): void;
|
|
23
|
+
inquire<T>(inquirePayload: InquirePayload | Array<InquirePayload>): Promise<T>;
|
|
24
|
+
prompt(name: string, options?: CliUXPromptOptions): Promise<any>;
|
|
25
|
+
confirm(message?: string): Promise<boolean>;
|
|
26
|
+
progress(options?: any): any;
|
|
27
|
+
loaderV2(message?: string, spinner?: any): Ora | void;
|
|
22
28
|
}
|
|
23
29
|
declare const _default: CLIInterface;
|
|
24
30
|
export default _default;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ContentstackClient, ContentstackConfig } from '@contentstack/management';
|
|
2
2
|
declare class ManagementSDKInitiator {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
private analyticsInfo;
|
|
4
|
+
constructor();
|
|
5
|
+
init(context: any): void;
|
|
6
|
+
createAPIClient(config: any): Promise<ContentstackClient>;
|
|
7
7
|
}
|
|
8
|
-
declare const _default: (config: any) => Promise<ContentstackClient>;
|
|
9
8
|
export declare const managementSDKInitiator: ManagementSDKInitiator;
|
|
9
|
+
declare const _default: any;
|
|
10
10
|
export default _default;
|
|
11
11
|
export { ContentstackConfig, ContentstackClient };
|
package/types/helpers.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const isAuthenticated: () => Promise<boolean>;
|
|
@@ -225,6 +225,9 @@ export declare class HttpClient implements IHttpClient {
|
|
|
225
225
|
* Returns the request payload depending on the selected request payload format.
|
|
226
226
|
*/
|
|
227
227
|
prepareRequestPayload(): any;
|
|
228
|
+
refreshToken(): Promise<{
|
|
229
|
+
authorization: string;
|
|
230
|
+
}>;
|
|
228
231
|
}
|
|
229
232
|
export interface HttpRequestConfig extends AxiosRequestConfig {
|
|
230
233
|
}
|
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
import { IPromptOptions } from
|
|
1
|
+
import { IPromptOptions } from '@oclif/core/lib/cli-ux';
|
|
2
2
|
export interface PrintOptions {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
bold?: boolean;
|
|
4
|
+
color?: string;
|
|
5
5
|
}
|
|
6
6
|
export interface InquirePayload {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
type: string;
|
|
8
|
+
name: string;
|
|
9
|
+
default?: any;
|
|
10
|
+
message: string;
|
|
11
|
+
choices?: Array<any>;
|
|
12
|
+
transformer?: Function;
|
|
13
|
+
validate?(input: any, answers?: any): boolean | string | Promise<boolean | string>;
|
|
14
|
+
columns?: Array<any>;
|
|
15
|
+
rows?: Array<any>;
|
|
16
|
+
selectAll?: boolean;
|
|
17
|
+
pageSize?: number;
|
|
14
18
|
}
|
|
15
19
|
export interface Region {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
name: string;
|
|
21
|
+
cma: string;
|
|
22
|
+
cda: string;
|
|
19
23
|
}
|
|
20
24
|
export interface Token {
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
token: string;
|
|
26
|
+
apiKey: string;
|
|
23
27
|
}
|
|
24
28
|
export interface Organization {
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
uid: string;
|
|
30
|
+
name: string;
|
|
27
31
|
}
|
|
28
32
|
export interface selectedOrganization {
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
orgUid: string;
|
|
34
|
+
orgName: string;
|
|
31
35
|
}
|
|
32
36
|
export interface Stack {
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
name: string;
|
|
38
|
+
api_key: string;
|
|
35
39
|
}
|
|
36
40
|
export interface ContentType {
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
uid: string;
|
|
42
|
+
title: string;
|
|
39
43
|
}
|
|
40
44
|
export interface Environment {
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
name: string;
|
|
46
|
+
uid: string;
|
|
43
47
|
}
|
|
44
48
|
export interface Entry {
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
uid: string;
|
|
50
|
+
title: string;
|
|
47
51
|
}
|
|
48
52
|
export interface Locale {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
export interface CliUXPromptOptions extends IPromptOptions {
|
|
53
|
+
name: string;
|
|
54
|
+
code: string;
|
|
53
55
|
}
|
|
56
|
+
export interface CliUXPromptOptions extends IPromptOptions {}
|