@contentstack/cli-utilities 2.0.0-beta.2 → 2.0.0-beta.4

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/chalk.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export type ChalkInstance = typeof import('chalk').default;
2
+ /**
3
+ * Load chalk (ESM) and cache it. Call this once during CLI init before any chalk usage.
4
+ */
5
+ export declare function loadChalk(): Promise<ChalkInstance>;
6
+ /**
7
+ * Get the cached chalk instance. Must call loadChalk() first (e.g. in init hook).
8
+ */
9
+ export declare function getChalk(): ChalkInstance;
package/lib/chalk.js ADDED
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.loadChalk = loadChalk;
37
+ exports.getChalk = getChalk;
38
+ /**
39
+ * Chalk 5 is ESM-only. We load it via dynamic import and cache for use in CommonJS.
40
+ */
41
+ let chalkInstance = null;
42
+ /**
43
+ * Load chalk (ESM) and cache it. Call this once during CLI init before any chalk usage.
44
+ */
45
+ async function loadChalk() {
46
+ if (!chalkInstance) {
47
+ const chalkModule = await Promise.resolve().then(() => __importStar(require('chalk')));
48
+ chalkInstance = chalkModule.default;
49
+ }
50
+ return chalkInstance;
51
+ }
52
+ /**
53
+ * Get the cached chalk instance. Must call loadChalk() first (e.g. in init hook).
54
+ */
55
+ function getChalk() {
56
+ if (!chalkInstance) {
57
+ throw new Error('Chalk not loaded. Ensure loadChalk() is called during init (e.g. in utils-init hook).');
58
+ }
59
+ return chalkInstance;
60
+ }
package/lib/cli-ux.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Command = exports.Args = exports.Flags = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
5
+ const chalk_1 = require("./chalk");
6
6
  const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
7
7
  const core_1 = require("@oclif/core");
8
8
  Object.defineProperty(exports, "Args", { enumerable: true, get: function () { return core_1.Args; } });
@@ -27,7 +27,8 @@ class CLIInterface {
27
27
  }
28
28
  print(message, opts) {
29
29
  if (opts) {
30
- let chalkFn = chalk_1.default;
30
+ const chalk = (0, chalk_1.getChalk)();
31
+ let chalkFn = chalk;
31
32
  if (opts.color)
32
33
  chalkFn = chalkFn[opts.color];
33
34
  if (opts.bold)
@@ -38,10 +39,10 @@ class CLIInterface {
38
39
  core_1.ux.stdout(message_handler_1.default.parse(message));
39
40
  }
40
41
  success(message) {
41
- core_1.ux.stdout(chalk_1.default.green(message_handler_1.default.parse(message)));
42
+ core_1.ux.stdout((0, chalk_1.getChalk)().green(message_handler_1.default.parse(message)));
42
43
  }
43
44
  error(message, ...params) {
44
- core_1.ux.stdout(chalk_1.default.red(message_handler_1.default.parse(message) + (params && params.length > 0 ? ': ' : '')), ...params);
45
+ core_1.ux.stdout((0, chalk_1.getChalk)().red(message_handler_1.default.parse(message) + (params && params.length > 0 ? ': ' : '')), ...params);
45
46
  }
46
47
  loader(message = '') {
47
48
  if (!this.loading) {
@@ -56,13 +57,25 @@ class CLIInterface {
56
57
  cli_table_1.default.render(headers, data, flags, options);
57
58
  }
58
59
  async inquire(inquirePayload) {
59
- if (Array.isArray(inquirePayload)) {
60
- return inquirer_1.default.prompt(inquirePayload);
60
+ var _a, _b;
61
+ try {
62
+ if (Array.isArray(inquirePayload)) {
63
+ return (await inquirer_1.default.prompt(inquirePayload));
64
+ }
65
+ else {
66
+ inquirePayload.message = message_handler_1.default.parse(inquirePayload.message);
67
+ const result = (await inquirer_1.default.prompt(inquirePayload));
68
+ return result[inquirePayload.name];
69
+ }
61
70
  }
62
- else {
63
- inquirePayload.message = message_handler_1.default.parse(inquirePayload.message);
64
- const result = await inquirer_1.default.prompt(inquirePayload);
65
- return result[inquirePayload.name];
71
+ catch (err) {
72
+ const isExitPrompt = (err === null || err === void 0 ? void 0 : err.name) === 'ExitPromptError' ||
73
+ ((_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.includes('SIGINT')) ||
74
+ ((_b = err === null || err === void 0 ? void 0 : err.message) === null || _b === void 0 ? void 0 : _b.includes('force closed'));
75
+ if (isExitPrompt) {
76
+ process.exit(130);
77
+ }
78
+ throw err;
66
79
  }
67
80
  }
68
81
  async prompt(message, options) {
@@ -5,7 +5,7 @@ const conf_1 = tslib_1.__importDefault(require("conf"));
5
5
  const has_1 = tslib_1.__importDefault(require("lodash/has"));
6
6
  const uuid_1 = require("uuid");
7
7
  const fs_1 = require("fs");
8
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
+ const chalk_1 = require("./chalk");
9
9
  const _1 = require(".");
10
10
  const ENC_KEY = process.env.ENC_KEY || 'encryptionKey';
11
11
  const ENCRYPT_CONF = (0, has_1.default)(process.env, 'ENCRYPT_CONF') ? process.env.ENCRYPT_CONF === 'true' : true;
@@ -77,7 +77,7 @@ class Config {
77
77
  }
78
78
  safeDeleteConfigIfInvalid(configFilePath) {
79
79
  if ((0, fs_1.existsSync)(configFilePath) && !this.isConfigFileValid(configFilePath)) {
80
- console.warn(chalk_1.default.yellow(`Warning: Detected corrupted config at ${configFilePath}. Removing...`));
80
+ console.warn((0, chalk_1.getChalk)().yellow(`Warning: Detected corrupted config at ${configFilePath}. Removing...`));
81
81
  (0, fs_1.unlinkSync)(configFilePath);
82
82
  }
83
83
  }
@@ -137,7 +137,7 @@ class Config {
137
137
  this.getEncryptedConfig(oldConfigData, true);
138
138
  }
139
139
  catch (_error) {
140
- _1.cliux.print(chalk_1.default.red('Error: Config file is corrupted'));
140
+ _1.cliux.print((0, chalk_1.getChalk)().red('Error: Config file is corrupted'));
141
141
  _1.cliux.print(_error);
142
142
  process.exit(1);
143
143
  }
@@ -188,7 +188,7 @@ class Config {
188
188
  }
189
189
  catch (__error) {
190
190
  // console.trace(error.message)
191
- _1.cliux.print(chalk_1.default.red('Error: Config file is corrupted'));
191
+ _1.cliux.print((0, chalk_1.getChalk)().red('Error: Config file is corrupted'));
192
192
  _1.cliux.print(_error);
193
193
  process.exit(1);
194
194
  }
@@ -5,7 +5,7 @@ exports.logLevels = {
5
5
  error: 0,
6
6
  warn: 1,
7
7
  info: 2,
8
- success: 2,
8
+ success: 2, // Maps to info level but with different type
9
9
  debug: 3,
10
10
  verbose: 4,
11
11
  };
@@ -13,7 +13,7 @@ exports.logLevels = {
13
13
  exports.levelColors = {
14
14
  error: 'red',
15
15
  warn: 'yellow',
16
- success: 'green',
16
+ success: 'green', // Custom color for success
17
17
  info: 'white',
18
18
  debug: 'blue',
19
19
  };
@@ -2,6 +2,6 @@
2
2
  * Reads all content type schema files from a directory
3
3
  * @param dirPath - Path to content types directory
4
4
  * @param ignoredFiles - Files to ignore (defaults to schema.json, .DS_Store, __master.json, __priority.json)
5
- * @returns Array of content type schemas
5
+ * @returns Array of content type schemas (empty if the path is missing or has no eligible files)
6
6
  */
7
- export declare function readContentTypeSchemas(dirPath: string, ignoredFiles?: string[]): Record<string, unknown>[] | null;
7
+ export declare function readContentTypeSchemas(dirPath: string, ignoredFiles?: string[]): Record<string, unknown>[];
@@ -1,19 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readContentTypeSchemas = void 0;
3
+ exports.readContentTypeSchemas = readContentTypeSchemas;
4
+ const node_fs_1 = require("node:fs");
4
5
  const node_path_1 = require("node:path");
5
- const fs_utility_1 = require("./fs-utility");
6
6
  /**
7
7
  * Reads all content type schema files from a directory
8
8
  * @param dirPath - Path to content types directory
9
9
  * @param ignoredFiles - Files to ignore (defaults to schema.json, .DS_Store, __master.json, __priority.json)
10
- * @returns Array of content type schemas
10
+ * @returns Array of content type schemas (empty if the path is missing or has no eligible files)
11
11
  */
12
12
  function readContentTypeSchemas(dirPath, ignoredFiles = ['schema.json', '.DS_Store', '__master.json', '__priority.json', 'field_rules_uid.json']) {
13
- const fsUtil = new fs_utility_1.FsUtility();
14
- const files = fsUtil.readdir(dirPath);
13
+ if (!(0, node_fs_1.existsSync)(dirPath)) {
14
+ return [];
15
+ }
16
+ const files = (0, node_fs_1.readdirSync)(dirPath);
15
17
  if (!files || files.length === 0) {
16
- return null;
18
+ return [];
17
19
  }
18
20
  const contentTypes = [];
19
21
  for (const file of files) {
@@ -27,7 +29,8 @@ function readContentTypeSchemas(dirPath, ignoredFiles = ['schema.json', '.DS_Sto
27
29
  }
28
30
  try {
29
31
  const filePath = (0, node_path_1.resolve)(dirPath, file);
30
- const contentType = fsUtil.readFile(filePath);
32
+ const raw = (0, node_fs_1.readFileSync)(filePath, 'utf8');
33
+ const contentType = JSON.parse(raw);
31
34
  if (contentType) {
32
35
  contentTypes.push(contentType);
33
36
  }
@@ -39,4 +42,3 @@ function readContentTypeSchemas(dirPath, ignoredFiles = ['schema.json', '.DS_Sto
39
42
  }
40
43
  return contentTypes;
41
44
  }
42
- exports.readContentTypeSchemas = readContentTypeSchemas;
@@ -15,15 +15,21 @@ class ManagementSDKInitiator {
15
15
  this.analyticsInfo = context === null || context === void 0 ? void 0 : context.analyticsInfo;
16
16
  }
17
17
  async createAPIClient(config) {
18
- // Get proxy configuration with priority: Environment variables > Global config
19
- const proxyConfig = (0, proxy_helper_1.getProxyConfig)();
18
+ // Resolve host so NO_PROXY applies even when config.host is omitted (e.g. from region.cma)
19
+ const host = (0, proxy_helper_1.resolveRequestHost)(config);
20
+ // NO_PROXY has priority over HTTP_PROXY/HTTPS_PROXY and config-set proxy
21
+ const proxyConfig = (0, proxy_helper_1.getProxyConfigForHost)(host);
22
+ // When bypassing, clear proxy env immediately so SDK never see it (they may read at init or first request).
23
+ if (!proxyConfig) {
24
+ (0, proxy_helper_1.clearProxyEnv)();
25
+ }
20
26
  const option = {
21
27
  host: config.host,
22
28
  maxContentLength: config.maxContentLength || 100000000,
23
29
  maxBodyLength: config.maxBodyLength || 1000000000,
24
30
  maxRequests: 10,
25
31
  retryLimit: 3,
26
- timeout: proxyConfig ? 10000 : 60000,
32
+ timeout: proxyConfig ? 10000 : 60000, // 10s timeout with proxy, 60s without
27
33
  delayMs: config.delayMs,
28
34
  httpsAgent: new node_https_1.Agent({
29
35
  maxSockets: 100,
@@ -23,7 +23,7 @@ class MarketplaceSDKInitiator {
23
23
  maxContentLength: 100000000,
24
24
  maxBodyLength: 1000000000,
25
25
  httpsAgent: new node_https_1.Agent({
26
- timeout: 60000,
26
+ timeout: 60000, // active socket keepalive for 60 seconds
27
27
  maxSockets: 100,
28
28
  keepAlive: true,
29
29
  maxFreeSockets: 10,
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Chunk, PageInfo, WriteFileOptions, FsConstructorOptions, ChunkFilesGetterType } from './types';
3
2
  export default class FsUtility {
4
3
  private isArray;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFileList = exports.getDirectories = void 0;
3
+ exports.getDirectories = getDirectories;
4
+ exports.getFileList = getFileList;
4
5
  const tslib_1 = require("tslib");
5
6
  const mkdirp_1 = tslib_1.__importDefault(require("mkdirp"));
6
7
  const keys_1 = tslib_1.__importDefault(require("lodash/keys"));
@@ -358,7 +359,6 @@ function getDirectories(source) {
358
359
  .filter((dirent) => dirent.isDirectory())
359
360
  .map((dirent) => dirent.name);
360
361
  }
361
- exports.getDirectories = getDirectories;
362
362
  async function getFileList(dirName, onlyName = true) {
363
363
  if (!(0, node_fs_1.existsSync)(dirName))
364
364
  return [];
@@ -375,4 +375,3 @@ async function getFileList(dirName, onlyName = true) {
375
375
  }
376
376
  return files;
377
377
  }
378
- exports.getFileList = getFileList;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMetaData = exports.mapKeyAndVal = void 0;
3
+ exports.mapKeyAndVal = mapKeyAndVal;
4
+ exports.getMetaData = getMetaData;
4
5
  const tslib_1 = require("tslib");
5
6
  const map_1 = tslib_1.__importDefault(require("lodash/map"));
6
7
  const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
@@ -22,7 +23,6 @@ function mapKeyAndVal(array, keyName, omitKeys = []) {
22
23
  return { [row[keyName]]: (0, omit_1.default)(row, omitKeys) };
23
24
  }));
24
25
  }
25
- exports.mapKeyAndVal = mapKeyAndVal;
26
26
  function getMetaData(array, pickKeys, handler) {
27
27
  if (handler instanceof Function)
28
28
  handler(array);
@@ -30,4 +30,3 @@ function getMetaData(array, pickKeys, handler) {
30
30
  return;
31
31
  return (0, map_1.default)(array, (row) => (0, pick_1.default)(row, pickKeys));
32
32
  }
33
- exports.getMetaData = getMetaData;
package/lib/helpers.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ContentstackClient } from '.';
2
2
  export declare const isAuthenticated: () => boolean;
3
3
  export declare const doesBranchExist: (stack: any, branchName: any) => Promise<any>;
4
- export declare const getBranchFromAlias: (stack: ReturnType<ContentstackClient['stack']>, branchAlias: string) => Promise<string>;
4
+ export declare const getBranchFromAlias: (stack: ReturnType<ContentstackClient["stack"]>, branchAlias: string) => Promise<string>;
5
5
  export declare const isManagementTokenValid: (stackAPIKey: any, managementToken: any) => Promise<{
6
6
  valid: boolean;
7
7
  message?: undefined;
package/lib/helpers.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLogContext = exports.getAuthenticationMethod = exports.clearProgressModuleSetting = exports.redactObject = exports.formatError = exports.validateRegex = exports.validateFileName = exports.validateUids = exports.sanitizePath = exports.escapeRegExp = exports.validatePath = exports.createDeveloperHubUrl = exports.isManagementTokenValid = exports.getBranchFromAlias = exports.doesBranchExist = exports.isAuthenticated = void 0;
3
+ exports.redactObject = exports.formatError = exports.validateRegex = exports.validateFileName = exports.validateUids = exports.sanitizePath = exports.escapeRegExp = exports.validatePath = exports.createDeveloperHubUrl = exports.isManagementTokenValid = exports.getBranchFromAlias = exports.doesBranchExist = exports.isAuthenticated = void 0;
4
+ exports.clearProgressModuleSetting = clearProgressModuleSetting;
5
+ exports.getAuthenticationMethod = getAuthenticationMethod;
6
+ exports.createLogContext = createLogContext;
4
7
  const tslib_1 = require("tslib");
5
8
  const recheck_1 = require("recheck");
6
9
  const traverse_1 = tslib_1.__importDefault(require("traverse"));
@@ -251,7 +254,6 @@ function clearProgressModuleSetting() {
251
254
  _1.configHandler.set('log', logConfig);
252
255
  }
253
256
  }
254
- exports.clearProgressModuleSetting = clearProgressModuleSetting;
255
257
  /**
256
258
  * Get authentication method from config
257
259
  * @returns Authentication method string ('OAuth', 'Basic Auth', or empty string)
@@ -268,7 +270,6 @@ function getAuthenticationMethod() {
268
270
  // Return empty string if unknown
269
271
  return '';
270
272
  }
271
- exports.getAuthenticationMethod = getAuthenticationMethod;
272
273
  /**
273
274
  * Creates a standardized context object for logging
274
275
  * This context contains all session-level metadata that should be in session.json
@@ -296,4 +297,3 @@ function createLogContext(commandId, apiKey, authenticationMethod) {
296
297
  authenticationMethod: authMethod,
297
298
  };
298
299
  }
299
- exports.createLogContext = createLogContext;
@@ -229,8 +229,8 @@ export declare class HttpClient implements IHttpClient {
229
229
  * Get the axios instance for interceptor access
230
230
  */
231
231
  get interceptors(): {
232
- request: import("axios").AxiosInterceptorManager<import("axios").InternalAxiosRequestConfig<any>>;
233
- response: import("axios").AxiosInterceptorManager<AxiosResponse<any, any, {}>>;
232
+ request: import("axios").AxiosInterceptorManager<import("axios").InternalAxiosRequestConfig>;
233
+ response: import("axios").AxiosInterceptorManager<AxiosResponse>;
234
234
  };
235
235
  /**
236
236
  * Returns the request payload depending on the selected request payload format.
@@ -7,6 +7,22 @@ const http_response_1 = require("./http-response");
7
7
  const config_handler_1 = tslib_1.__importDefault(require("../config-handler"));
8
8
  const auth_handler_1 = tslib_1.__importDefault(require("../auth-handler"));
9
9
  const proxy_helper_1 = require("../proxy-helper");
10
+ /**
11
+ * Derive request host from baseURL or url for NO_PROXY checks.
12
+ */
13
+ function getRequestHost(baseURL, url) {
14
+ const toTry = [baseURL, url].filter(Boolean);
15
+ for (const candidateUrl of toTry) {
16
+ try {
17
+ const parsed = new URL(candidateUrl.startsWith('http') ? candidateUrl : `https://${candidateUrl}`);
18
+ return parsed.hostname || undefined;
19
+ }
20
+ catch (_a) {
21
+ // Invalid URL; try next candidate (baseURL or url)
22
+ }
23
+ }
24
+ return undefined;
25
+ }
10
26
  class HttpClient {
11
27
  /**
12
28
  * Createa new pending HTTP request instance.
@@ -340,9 +356,10 @@ class HttpClient {
340
356
  this.headers({ 'x-header-ea': Object.values(earlyAccessHeaders).join(',') });
341
357
  }
342
358
  }
343
- // Configure proxy if available (priority: request.proxy > getProxyConfig())
359
+ // Configure proxy if available. NO_PROXY has priority: hosts in NO_PROXY never use proxy.
344
360
  if (!this.request.proxy) {
345
- const proxyConfig = (0, proxy_helper_1.getProxyConfig)();
361
+ const host = getRequestHost(this.request.baseURL, url);
362
+ const proxyConfig = host ? (0, proxy_helper_1.getProxyConfigForHost)(host) : (0, proxy_helper_1.getProxyConfig)();
346
363
  if (proxyConfig) {
347
364
  this.request.proxy = proxyConfig;
348
365
  }
package/lib/index.d.ts CHANGED
@@ -24,6 +24,8 @@ export { App, AppData, Installation, marketplaceSDKClient, MarketplaceSDKInitiat
24
24
  export { Args, CommandHelp, Config, Errors, Flags, loadHelpClass, Help, HelpBase, HelpSection, HelpSectionRenderer, HelpSectionKeyValueTable, Hook, Interfaces, Parser, Plugin, run, toStandardizedId, toConfiguredId, settings, Settings, flush, ux, execute, } from '@oclif/core';
25
25
  export { FlagInput, ArgInput, FlagDefinition } from '@oclif/core/lib/interfaces/parser';
26
26
  export { default as TablePrompt } from './inquirer-table-prompt';
27
+ export { loadChalk, getChalk } from './chalk';
28
+ export type { ChalkInstance } from './chalk';
27
29
  export { Logger };
28
30
  export { default as authenticationHandler } from './authentication-handler';
29
31
  export { v2Logger as log, cliErrorHandler, handleAndLogError, getLogPath, getSessionLogPath } from './logger/log';
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultProgressStrategy = exports.CustomProgressStrategy = exports.ProgressStrategyRegistry = exports.PrimaryProcessStrategy = exports.SummaryManager = exports.CLIProgressManager = exports.getSessionLogPath = exports.getLogPath = exports.handleAndLogError = exports.cliErrorHandler = exports.log = exports.authenticationHandler = exports.Logger = exports.TablePrompt = exports.execute = exports.ux = exports.flush = exports.settings = exports.toConfiguredId = exports.toStandardizedId = exports.run = exports.Plugin = exports.Parser = exports.Interfaces = exports.HelpBase = exports.Help = exports.loadHelpClass = exports.Flags = exports.Errors = exports.Config = exports.CommandHelp = exports.Args = exports.marketplaceSDKInitiator = exports.MarketplaceSDKInitiator = exports.marketplaceSDKClient = exports.CLITable = exports.createLogContext = exports.Command = exports.flags = exports.args = exports.NodeCrypto = exports.managementSDKInitiator = exports.managementSDKClient = exports.configHandler = exports.authHandler = exports.messageHandler = exports.CLIError = exports.cliux = exports.LoggerService = void 0;
3
+ exports.DefaultProgressStrategy = exports.CustomProgressStrategy = exports.ProgressStrategyRegistry = exports.PrimaryProcessStrategy = exports.SummaryManager = exports.CLIProgressManager = exports.getSessionLogPath = exports.getLogPath = exports.handleAndLogError = exports.cliErrorHandler = exports.log = exports.authenticationHandler = exports.Logger = exports.getChalk = exports.loadChalk = exports.TablePrompt = exports.execute = exports.ux = exports.flush = exports.settings = exports.toConfiguredId = exports.toStandardizedId = exports.Plugin = exports.Parser = exports.Interfaces = exports.HelpBase = exports.Help = exports.loadHelpClass = exports.Flags = exports.Errors = exports.Config = exports.CommandHelp = exports.Args = exports.marketplaceSDKInitiator = exports.MarketplaceSDKInitiator = exports.marketplaceSDKClient = exports.CLITable = exports.createLogContext = exports.Command = exports.flags = exports.args = exports.NodeCrypto = exports.managementSDKInitiator = exports.managementSDKClient = exports.configHandler = exports.authHandler = exports.messageHandler = exports.CLIError = exports.cliux = exports.LoggerService = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const logger_1 = tslib_1.__importDefault(require("./logger"));
6
6
  exports.Logger = logger_1.default;
@@ -64,6 +64,9 @@ Object.defineProperty(exports, "ux", { enumerable: true, get: function () { retu
64
64
  Object.defineProperty(exports, "execute", { enumerable: true, get: function () { return core_1.execute; } });
65
65
  var inquirer_table_prompt_1 = require("./inquirer-table-prompt");
66
66
  Object.defineProperty(exports, "TablePrompt", { enumerable: true, get: function () { return tslib_1.__importDefault(inquirer_table_prompt_1).default; } });
67
+ var chalk_1 = require("./chalk");
68
+ Object.defineProperty(exports, "loadChalk", { enumerable: true, get: function () { return chalk_1.loadChalk; } });
69
+ Object.defineProperty(exports, "getChalk", { enumerable: true, get: function () { return chalk_1.getChalk; } });
67
70
  var authentication_handler_1 = require("./authentication-handler");
68
71
  Object.defineProperty(exports, "authenticationHandler", { enumerable: true, get: function () { return tslib_1.__importDefault(authentication_handler_1).default; } });
69
72
  var log_1 = require("./logger/log");
@@ -1,30 +1,51 @@
1
- declare const Base: any;
2
- declare class TablePrompt extends Base {
3
- /**
4
- * Initialise the prompt
5
- *
6
- * @param {Object} questions
7
- * @param {Object} rl
8
- * @param {Object} answers
9
- */
10
- constructor(questions: any, rl: any, answers: any);
11
- /**
12
- * Start the inquirer session
13
- *
14
- * @param {Function} callback
15
- * @return {TablePrompt}
16
- */
17
- _run(callback: any): this;
18
- getCurrentValue(): any[];
19
- onDownKey(): void;
20
- onEnd(state: any): void;
21
- onError(state: any): void;
22
- onLeftKey(): void;
23
- onRightKey(): void;
24
- selectAllValues(value: any): void;
25
- onSpaceKey(): void;
26
- onUpKey(): void;
27
- paginate(): number[];
28
- render(error?: string): void;
1
+ /**
2
+ * Table prompt for inquirer v12.
3
+ * Standalone implementation (no inquirer/lib) compatible with
4
+ * inquirer 12 legacy adapter: constructor(question, rl, answers) + run() returns Promise.
5
+ */
6
+ import * as readline from 'readline';
7
+ interface ChoiceLike {
8
+ name?: string;
9
+ value?: string;
10
+ }
11
+ interface TableQuestion {
12
+ message?: string;
13
+ name?: string;
14
+ columns?: ChoiceLike[];
15
+ rows?: ChoiceLike[];
16
+ selectAll?: boolean;
17
+ pageSize?: number;
18
+ }
19
+ type ReadLine = readline.Interface & {
20
+ input: NodeJS.ReadableStream;
21
+ output: NodeJS.WritableStream;
22
+ };
23
+ declare class TablePrompt {
24
+ private question;
25
+ private rl;
26
+ private selectAll;
27
+ private columns;
28
+ private rows;
29
+ private pointer;
30
+ private horizontalPointer;
31
+ private values;
32
+ private pageSize;
33
+ private spaceKeyPressed;
34
+ private status;
35
+ private done;
36
+ private lastHeight;
37
+ constructor(question: TableQuestion, rl: ReadLine, _answers: Record<string, unknown>);
38
+ run(): Promise<(string | undefined)[]>;
39
+ private getCurrentValue;
40
+ private onSubmit;
41
+ private onUpKey;
42
+ private onDownKey;
43
+ private onLeftKey;
44
+ private onRightKey;
45
+ private selectAllValues;
46
+ private onSpaceKey;
47
+ private paginate;
48
+ private getMessage;
49
+ private render;
29
50
  }
30
51
  export = TablePrompt;