|
1 | | -import * as contentstackSdk from '@contentstack/management' |
2 | | -import {cli} from 'cli-ux' |
3 | | -import processStack from './process-stack' |
4 | | -const regexMessages = require('../../messages/index.json').validateRegex |
| 1 | +import { cli } from "cli-ux"; |
| 2 | +import * as contentstackSdk from "@contentstack/management"; |
5 | 3 |
|
6 | | -export default async function connectStack(flags: any, host: string, tokenDetails: any) { |
| 4 | +import processStack from "./process-stack"; |
| 5 | +const regexMessages = require("../../messages/index.json").validateRegex; |
| 6 | + |
| 7 | +export default async function connectStack( |
| 8 | + flags: any, |
| 9 | + host: string, |
| 10 | + tokenDetails: any |
| 11 | +) { |
7 | 12 | try { |
8 | | - const startTime = Date.now() |
9 | | - cli.action.start(regexMessages.cliAction.connectStackStart, '', {stdout: true}) |
| 13 | + const startTime = Date.now(); |
| 14 | + cli.action.start(regexMessages.cliAction.connectStackStart, "", { |
| 15 | + stdout: true, |
| 16 | + }); |
10 | 17 | const client = contentstackSdk.client({ |
11 | 18 | host: host, |
12 | | - }) |
13 | | - const stackInstance = await client.stack({api_key: tokenDetails.apiKey, management_token: tokenDetails.token}) |
14 | | - await processStack(flags, stackInstance, startTime) |
| 19 | + }); |
| 20 | + const stackInstance = client.stack({ |
| 21 | + api_key: tokenDetails.apiKey, |
| 22 | + management_token: tokenDetails.token, |
| 23 | + }); |
| 24 | + await processStack(flags, stackInstance, startTime); |
15 | 25 | } catch (error) { |
16 | | - throw new Error(regexMessages.errors.stack.apiKey) |
| 26 | + throw new Error(regexMessages.errors.stack.apiKey); |
17 | 27 | } |
18 | 28 | } |
0 commit comments