@contentstack/cli-auth 1.3.7 → 1.3.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.
- package/README.md +1 -1
- package/lib/commands/auth/login.d.ts +11 -0
- package/lib/commands/auth/logout.d.ts +10 -0
- package/lib/commands/auth/tokens/add.d.ts +9 -0
- package/lib/commands/auth/tokens/index.d.ts +8 -0
- package/lib/commands/auth/tokens/remove.d.ts +8 -0
- package/lib/commands/auth/whoami.d.ts +7 -0
- package/lib/config/index.d.ts +0 -0
- package/lib/interfaces/index.d.ts +20 -0
- package/lib/utils/auth-handler.d.ts +35 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/interactive.d.ts +5 -0
- package/lib/utils/tokens-validation.d.ts +34 -0
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth
|
|
|
18
18
|
$ csdx COMMAND
|
|
19
19
|
running command...
|
|
20
20
|
$ csdx (--version)
|
|
21
|
-
@contentstack/cli-auth/1.3.
|
|
21
|
+
@contentstack/cli-auth/1.3.9 linux-x64 node-v16.20.0
|
|
22
22
|
$ csdx --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ csdx COMMAND
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from '@contentstack/cli-command';
|
|
2
|
+
import { FlagInput } from '@contentstack/cli-utilities';
|
|
3
|
+
export default class LoginCommand extends Command {
|
|
4
|
+
static run: any;
|
|
5
|
+
static description: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static flags: FlagInput;
|
|
8
|
+
static aliases: string[];
|
|
9
|
+
run(): Promise<any>;
|
|
10
|
+
login(username: string, password: string): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@contentstack/cli-command';
|
|
2
|
+
import { FlagInput } from '@contentstack/cli-utilities';
|
|
3
|
+
export default class LogoutCommand extends Command {
|
|
4
|
+
static run: any;
|
|
5
|
+
static description: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static flags: FlagInput;
|
|
8
|
+
static aliases: string[];
|
|
9
|
+
run(): Promise<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from '@contentstack/cli-command';
|
|
2
|
+
import { FlagInput } from '@contentstack/cli-utilities';
|
|
3
|
+
export default class TokensAddCommand extends Command {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: FlagInput;
|
|
7
|
+
static usage: string;
|
|
8
|
+
run(): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from '@contentstack/cli-command';
|
|
2
|
+
import { FlagInput } from '@contentstack/cli-utilities';
|
|
3
|
+
export default class TokensRemoveCommand extends Command {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: FlagInput;
|
|
7
|
+
run(): Promise<any>;
|
|
8
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface AuthOptions {
|
|
2
|
+
contentstackClient: any;
|
|
3
|
+
}
|
|
4
|
+
export interface ContentStackManagementClient {
|
|
5
|
+
contentstackClient: object;
|
|
6
|
+
}
|
|
7
|
+
export interface PrintOptions {
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface InquirePayload {
|
|
11
|
+
type: string;
|
|
12
|
+
name: string;
|
|
13
|
+
message: string;
|
|
14
|
+
choices?: Array<any>;
|
|
15
|
+
transformer?: Function;
|
|
16
|
+
}
|
|
17
|
+
export interface User {
|
|
18
|
+
email: string;
|
|
19
|
+
authtoken: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { User } from '../interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* @class
|
|
4
|
+
* Auth handler
|
|
5
|
+
*/
|
|
6
|
+
declare class AuthHandler {
|
|
7
|
+
private _client;
|
|
8
|
+
private _host;
|
|
9
|
+
set client(contentStackClient: any);
|
|
10
|
+
set host(contentStackHost: any);
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* Login into Contentstack
|
|
15
|
+
* @param {string} email Contentstack email address
|
|
16
|
+
* @param {string} password User's password for contentstack account
|
|
17
|
+
* @returns {Promise} Promise object returns authtoken on success
|
|
18
|
+
* TBD: take out the otp implementation from login and create a new method/function to handle otp
|
|
19
|
+
*/
|
|
20
|
+
login(email: string, password: string, tfaToken?: string): Promise<User>;
|
|
21
|
+
/**
|
|
22
|
+
* Logout from Contentstack
|
|
23
|
+
* @param {string} authtoken authtoken that needs to invalidated when logging out
|
|
24
|
+
* @returns {Promise} Promise object returns response object from Contentstack
|
|
25
|
+
*/
|
|
26
|
+
logout(authtoken: string): Promise<object>;
|
|
27
|
+
/**
|
|
28
|
+
* Validate token
|
|
29
|
+
* @param {string} authtoken
|
|
30
|
+
* @returns {Promise} Promise object returns response object from Contentstack
|
|
31
|
+
*/
|
|
32
|
+
validateAuthtoken(authtoken: string): Promise<object>;
|
|
33
|
+
}
|
|
34
|
+
declare const _default: AuthHandler;
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const askPassword: () => Promise<string>;
|
|
2
|
+
export declare const askOTPChannel: () => Promise<string>;
|
|
3
|
+
export declare const askOTP: () => Promise<string>;
|
|
4
|
+
export declare const askUsername: () => Promise<string>;
|
|
5
|
+
export declare const askTokenType: () => Promise<string>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate delivery token
|
|
3
|
+
* @param contentStackClient
|
|
4
|
+
* @param apiKey
|
|
5
|
+
* @param deliveryToken
|
|
6
|
+
* @param environment
|
|
7
|
+
* @param region
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare const validateDeliveryToken: (contentStackClient: any, apiKey: string, deliveryToken: string, environment: string, region: string, host: string) => Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* Validate environment
|
|
13
|
+
* @param contentStackClient
|
|
14
|
+
* @param apiKey
|
|
15
|
+
* @param environment
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare const validateEnvironment: (contentStackClient: any, apiKey: string, environment: string) => Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Validate management token
|
|
21
|
+
* @param contentStackClient
|
|
22
|
+
* @param apiKey
|
|
23
|
+
* @param managementToken
|
|
24
|
+
* @returns { valid: boolean; message: any }
|
|
25
|
+
* Note: Fetching one content type using the management token to check whether it is valid or not
|
|
26
|
+
*/
|
|
27
|
+
export declare const validateManagementToken: (contentStackClient: any, apiKey: string, managementToken: string) => Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Validate API key
|
|
30
|
+
* @param contentStackClient
|
|
31
|
+
* @param apiKey
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export declare const validateAPIKey: (contentStackClient: any, apiKey: string) => Promise<any>;
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-auth",
|
|
3
3
|
"description": "Contentstack CLI plugin for authentication activities",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.9",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"scripts": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"test:unit": "mocha --forbid-only \"test/unit/*.test.ts\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@contentstack/cli-command": "^1.2.
|
|
25
|
-
"@contentstack/cli-utilities": "^1.4.
|
|
24
|
+
"@contentstack/cli-command": "^1.2.9",
|
|
25
|
+
"@contentstack/cli-utilities": "^1.4.5",
|
|
26
26
|
"chalk": "^4.0.0",
|
|
27
27
|
"debug": "^4.1.1",
|
|
28
28
|
"inquirer": "8.2.4",
|
|
@@ -85,4 +85,4 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"repository": "contentstack/cli"
|
|
88
|
-
}
|
|
88
|
+
}
|