@contentstack/cli-command 1.0.4 → 1.1.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/index.js +13 -5
- package/package.json +6 -6
- package/types/index.d.ts +22 -21
package/lib/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.flags = exports.Command = void 0;
|
|
4
|
-
const
|
|
5
|
-
Object.defineProperty(exports, "flags", { enumerable: true, get: function () { return
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
Object.defineProperty(exports, "flags", { enumerable: true, get: function () { return core_1.Flags; } });
|
|
6
6
|
const ContentstackManagementSDK = require("@contentstack/management");
|
|
7
7
|
const ContentstackDeliverySDK = require("contentstack");
|
|
8
8
|
const url = require("url");
|
|
9
9
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
10
10
|
const defaultRateLimit = 5;
|
|
11
|
-
class ContentstackCommand extends
|
|
11
|
+
class ContentstackCommand extends core_1.Command {
|
|
12
12
|
get context() {
|
|
13
13
|
// @ts-ignore
|
|
14
14
|
return this.config.context;
|
|
@@ -81,7 +81,6 @@ class ContentstackCommand extends command_1.Command {
|
|
|
81
81
|
this._authToken = cli_utilities_1.configHandler.get('authtoken');
|
|
82
82
|
if (this._authToken)
|
|
83
83
|
return this._authToken;
|
|
84
|
-
// throw new CLIError('You are not logged in. Please login with command $ csdx auth:login');
|
|
85
84
|
}
|
|
86
85
|
getToken(alias) {
|
|
87
86
|
if (alias) {
|
|
@@ -91,9 +90,18 @@ class ContentstackCommand extends command_1.Command {
|
|
|
91
90
|
}
|
|
92
91
|
throw new cli_utilities_1.CLIError('No token found');
|
|
93
92
|
}
|
|
93
|
+
isAuthenticated() {
|
|
94
|
+
const authtoken = cli_utilities_1.configHandler.get('authtoken');
|
|
95
|
+
if (authtoken) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
94
102
|
}
|
|
95
103
|
exports.Command = ContentstackCommand;
|
|
96
104
|
module.exports = {
|
|
97
105
|
Command: ContentstackCommand,
|
|
98
|
-
flags:
|
|
106
|
+
flags: core_1.Flags,
|
|
99
107
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-command",
|
|
3
3
|
"description": "Contentstack CLI plugin for configuration",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"format": "eslint src/**/*.ts --fix"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@contentstack/
|
|
22
|
-
"@
|
|
20
|
+
"@oclif/core": "^1.21.0",
|
|
21
|
+
"@contentstack/cli-utilities": "^1.1.0",
|
|
22
|
+
"@contentstack/management": "^1.6.1",
|
|
23
23
|
"contentstack": "^3.10.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@oclif/test": "^
|
|
26
|
+
"@oclif/test": "^2.2.10",
|
|
27
27
|
"@types/chai": "^4.2.18",
|
|
28
28
|
"@types/mkdirp": "^1.0.1",
|
|
29
29
|
"@types/mocha": "^8.2.2",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"mocha": "10.1.0",
|
|
38
38
|
"nyc": "^15.1.0",
|
|
39
39
|
"rimraf": "^2.7.1",
|
|
40
|
-
"sinon": "^
|
|
40
|
+
"sinon": "^15.0.1",
|
|
41
41
|
"ts-node": "^8.10.2",
|
|
42
42
|
"typescript": "^4.9.3"
|
|
43
43
|
},
|
package/types/index.d.ts
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { Command,
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
2
|
import { Region } from './interfaces';
|
|
3
3
|
declare abstract class ContentstackCommand extends Command {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
private _managementAPIClient;
|
|
5
|
+
private _email;
|
|
6
|
+
private _region;
|
|
7
|
+
private _rateLimit;
|
|
8
|
+
private _authToken;
|
|
9
|
+
private _deliveryAPIClient;
|
|
10
|
+
get context(): any;
|
|
11
|
+
get managementAPIClient(): object;
|
|
12
|
+
set managementAPIClient(params: object);
|
|
13
|
+
get email(): string;
|
|
14
|
+
get deliveryAPIClient(): any;
|
|
15
|
+
get region(): Region;
|
|
16
|
+
get rateLimit(): string | 5;
|
|
17
|
+
get cmaHost(): string;
|
|
18
|
+
get cdaHost(): string;
|
|
19
|
+
get cdaAPIUrl(): string;
|
|
20
|
+
get cmaAPIUrl(): string;
|
|
21
|
+
get authToken(): string;
|
|
22
|
+
getToken(alias: any): any;
|
|
23
|
+
isAuthenticated(): any;
|
|
23
24
|
}
|
|
24
|
-
export { ContentstackCommand as Command, flags };
|
|
25
|
+
export { ContentstackCommand as Command, Flags as flags };
|