@contentstack/cli-utilities
Version:
Utilities for contentstack projects
55 lines (54 loc) • 2.37 kB
TypeScript
import { ContentstackClient } from '.';
export declare const isAuthenticated: () => boolean;
export declare const doesBranchExist: (stack: any, branchName: any) => Promise<any>;
export declare const getBranchFromAlias: (stack: ReturnType<ContentstackClient['stack']>, branchAlias: string) => Promise<string>;
export declare const isManagementTokenValid: (stackAPIKey: any, managementToken: any) => Promise<{
valid: boolean;
message?: undefined;
} | {
valid: boolean;
message: any;
} | {
valid: string;
message: string;
}>;
export declare const createDeveloperHubUrl: (developerHubBaseUrl: string) => string;
export declare const validatePath: (input: string) => boolean;
export declare const escapeRegExp: (str: string) => string;
export declare const sanitizePath: (str: string) => string;
export declare const validateUids: (uid: any) => boolean;
export declare const validateFileName: (fileName: any) => boolean;
export declare const validateRegex: (str: unknown) => import("recheck").Diagnostics;
export declare const formatError: (error: any) => string;
/**
* The function redactObject takes an object as input and replaces any sensitive keys with the string
* '[REDACTED]'.
* @param {any} obj - The `obj` parameter is an object that you want to redact sensitive information
* from.
*/
export declare const redactObject: (obj: any) => any;
/**
* Get authentication method from config
* @returns Authentication method string ('OAuth', 'Basic Auth', or empty string)
*/
export declare function getAuthenticationMethod(): string;
/**
* Creates a standardized context object for logging
* This context contains all session-level metadata that should be in session.json
* The apiKey is stored in configHandler so it's available for session.json generation
*
* @param commandId - The command ID (e.g., 'cm:stacks:export')
* @param apiKey - The API key for the stack (will be stored in configHandler for session.json)
* @param authenticationMethod - Optional authentication method
* @returns Context object with all session-level metadata
*/
export declare function createLogContext(commandId: string, apiKey: string, authenticationMethod?: string): {
command: string;
module: string;
userId: string;
email: string;
sessionId: string;
apiKey: string;
orgId: string;
authenticationMethod: string;
};