@forge/cli-shared 9.7.0-next.1-experimental-13c2f8d → 9.7.0-next.10
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/CHANGELOG.md +49 -7
- package/out/ari/ari.d.ts +5 -0
- package/out/ari/ari.d.ts.map +1 -1
- package/out/ari/ari.js +13 -1
- package/out/graphql/graphql-types.d.ts +3176 -90
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/graphql/graphql-types.js +422 -56
- package/out/http-client/file-uploader.d.ts.map +1 -1
- package/out/http-client/file-uploader.js +2 -1
- package/out/http-client/node-request.d.ts +2 -0
- package/out/http-client/node-request.d.ts.map +1 -1
- package/out/http-client/node-request.js +4 -3
- package/out/tunnel/docker-compose-lifecycle.d.ts +0 -3
- package/out/tunnel/docker-compose-lifecycle.d.ts.map +1 -1
- package/out/tunnel/docker-compose-lifecycle.js +8 -10
- package/out/tunnel/index.d.ts +0 -1
- package/out/tunnel/index.d.ts.map +1 -1
- package/out/tunnel/index.js +0 -1
- package/out/tunnel/tunnel-options.d.ts +0 -2
- package/out/tunnel/tunnel-options.d.ts.map +1 -1
- package/out/ui/command-line-ui.d.ts +6 -3
- package/out/ui/command-line-ui.d.ts.map +1 -1
- package/out/ui/command-line-ui.js +41 -13
- package/out/ui/index.d.ts +1 -0
- package/out/ui/index.d.ts.map +1 -1
- package/out/ui/index.js +1 -0
- package/out/ui/table-prompt.d.ts.map +1 -1
- package/out/ui/table-prompt.js +2 -2
- package/out/ui/table.d.ts +9 -0
- package/out/ui/table.d.ts.map +1 -0
- package/out/ui/table.js +57 -0
- package/out/ui/text.d.ts +72 -66
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +82 -66
- package/out/ui/ui.d.ts +5 -1
- package/out/ui/ui.d.ts.map +1 -1
- package/package.json +3 -3
- package/out/tunnel/compose-project-lifecycle.d.ts +0 -39
- package/out/tunnel/compose-project-lifecycle.d.ts.map +0 -1
- package/out/tunnel/compose-project-lifecycle.js +0 -105
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-uploader.d.ts","sourceRoot":"","sources":["../../src/http-client/file-uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlD,qBAAa,qBAAsB,SAAQ,KAAK;CAAG;AACnD,qBAAa,uBAAwB,SAAQ,KAAK;CAAG;AACrD,qBAAa,oBAAqB,SAAQ,KAAK;CAAG;AAElD,MAAM,WAAW,YAAY;IAC3B,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAkBD,qBAAa,gBAAiB,YAAW,YAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,gBAAgB;IAE5C,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"file-uploader.d.ts","sourceRoot":"","sources":["../../src/http-client/file-uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlD,qBAAa,qBAAsB,SAAQ,KAAK;CAAG;AACnD,qBAAa,uBAAwB,SAAQ,KAAK;CAAG;AACrD,qBAAa,oBAAqB,SAAQ,KAAK;CAAG;AAElD,MAAM,WAAW,YAAY;IAC3B,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAkBD,qBAAa,gBAAiB,YAAW,YAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,gBAAgB;IAE5C,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAgB1E"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
|
+
export declare const DEFAULT_NODE_REQUEST_TIMEOUT_MS = 30000;
|
|
3
|
+
export declare const DEFAULT_NODE_UPLOAD_TIMEOUT_MS = 300000;
|
|
2
4
|
export declare const toHeaders: (rawHeaders: http.IncomingHttpHeaders) => Headers;
|
|
3
5
|
export declare const sendWithNodeRequest: ({ method, url, headers, body, timeoutMs }: {
|
|
4
6
|
method: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-request.d.ts","sourceRoot":"","sources":["../../src/http-client/node-request.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"node-request.d.ts","sourceRoot":"","sources":["../../src/http-client/node-request.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAKxB,eAAO,MAAM,+BAA+B,QAAS,CAAC;AAEtD,eAAO,MAAM,8BAA8B,SAAU,CAAC;AAGtD,eAAO,MAAM,SAAS,GAAI,YAAY,IAAI,CAAC,mBAAmB,KAAG,OAYhE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,2CAMjC;IACD,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,KAAG,OAAO,CAAC,QAAQ,CAsCnB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendWithNodeRequest = exports.toHeaders = void 0;
|
|
3
|
+
exports.sendWithNodeRequest = exports.toHeaders = exports.DEFAULT_NODE_UPLOAD_TIMEOUT_MS = exports.DEFAULT_NODE_REQUEST_TIMEOUT_MS = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const http_1 = tslib_1.__importDefault(require("http"));
|
|
6
6
|
const https_1 = tslib_1.__importDefault(require("https"));
|
|
7
7
|
const url_1 = require("url");
|
|
8
8
|
const DEFAULT_HTTP_ERROR_STATUS = 500;
|
|
9
|
-
|
|
9
|
+
exports.DEFAULT_NODE_REQUEST_TIMEOUT_MS = 30_000;
|
|
10
|
+
exports.DEFAULT_NODE_UPLOAD_TIMEOUT_MS = 300_000;
|
|
10
11
|
const NO_BODY_STATUS_CODES = new Set([204, 205, 304]);
|
|
11
12
|
const toHeaders = (rawHeaders) => {
|
|
12
13
|
const headers = new Headers();
|
|
@@ -22,7 +23,7 @@ const toHeaders = (rawHeaders) => {
|
|
|
22
23
|
return headers;
|
|
23
24
|
};
|
|
24
25
|
exports.toHeaders = toHeaders;
|
|
25
|
-
const sendWithNodeRequest = ({ method, url, headers, body, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS }) => {
|
|
26
|
+
const sendWithNodeRequest = ({ method, url, headers, body, timeoutMs = exports.DEFAULT_NODE_REQUEST_TIMEOUT_MS }) => {
|
|
26
27
|
return new Promise((resolve, reject) => {
|
|
27
28
|
const parsedUrl = new url_1.URL(url);
|
|
28
29
|
const transport = parsedUrl.protocol === 'https:' ? https_1.default : http_1.default;
|
|
@@ -6,7 +6,6 @@ import { ChildProcess } from 'child_process';
|
|
|
6
6
|
export declare const PROXY_SIDECAR_VOLUME_DIR = "/forge/container";
|
|
7
7
|
export declare const CONTAINER_SERVICE_ASSETS = ".container-service-assets";
|
|
8
8
|
export declare const K8S_AUTH_TOKEN_FILENAME = "local-account";
|
|
9
|
-
export declare const DOCKER_LIFECYCLE_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
|
|
10
9
|
export declare const STARTUP_TIMER_MS: number;
|
|
11
10
|
export declare const STARTUP_TIMER_BUFFER_MS: number;
|
|
12
11
|
export declare class InvalidContainerServicePort extends UserError {
|
|
@@ -33,9 +32,7 @@ export declare class DockerAuthenticationError extends UserError {
|
|
|
33
32
|
export declare const generateContainersDockerComposeFile: (services: Services, appId: string, envId: string) => Promise<Record<string, string>>;
|
|
34
33
|
export declare const deleteDockerComposeFile: (composeFile: string) => Promise<void>;
|
|
35
34
|
export declare const startDockerComposeStack: (dockerComposeFilePath: string, serviceKey: string, logger: Logger) => Promise<void>;
|
|
36
|
-
export declare const getDockerComposeErrorMessage: (error: unknown) => string;
|
|
37
35
|
export declare const determineComposeFlags: (dockerComposeFilePath: string, serviceKey: string, logger: Logger) => Promise<string[]>;
|
|
38
36
|
export declare const stopDockerComposeStack: (configFile: ConfigFile, logger: Logger, composeFiles?: Record<string, string>) => Promise<void>;
|
|
39
|
-
export declare const createDockerLifecycleLogFilter: (logger: Logger) => (chunk: Buffer) => void;
|
|
40
37
|
export declare const processDockerAuthentication: (childProcess: ChildProcess) => Promise<void>;
|
|
41
38
|
//# sourceMappingURL=docker-compose-lifecycle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker-compose-lifecycle.d.ts","sourceRoot":"","sources":["../../src/tunnel/docker-compose-lifecycle.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAO3C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAC3D,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AACpE,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"docker-compose-lifecycle.d.ts","sourceRoot":"","sources":["../../src/tunnel/docker-compose-lif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A8B9G,CAAC;AA6BF,eAAO,MAAM,qBAAqB,GAChC,uBAAuB,MAAM,EAC7B,YAAY,MAAM,EAClB,QAAQ,MAAM,KACb,OAAO,CAAC,MAAM,EAAE,CAgBlB,CAAC;AA2LF,eAAO,MAAM,sBAAsB,GACjC,YAAY,UAAU,EACtB,QAAQ,MAAM,EACd,eAAe,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,kBAmCtC,CAAC;AAgCF,eAAO,MAAM,2BAA2B,GAAU,cAAc,YAAY,kBAW3E,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processDockerAuthentication = exports.
|
|
3
|
+
exports.processDockerAuthentication = exports.stopDockerComposeStack = exports.determineComposeFlags = exports.startDockerComposeStack = exports.deleteDockerComposeFile = exports.generateContainersDockerComposeFile = exports.DockerAuthenticationError = exports.CannotUseBothImageAndBuildContextError = exports.MissingImageOrBuildContextError = exports.UnableToParseDockerComposeFileError = exports.DockerUnableToStartError = exports.DockerUnableToPullProxySidecarImage = exports.InvalidContainerServicePort = exports.STARTUP_TIMER_BUFFER_MS = exports.STARTUP_TIMER_MS = exports.K8S_AUTH_TOKEN_FILENAME = exports.CONTAINER_SERVICE_ASSETS = exports.PROXY_SIDECAR_VOLUME_DIR = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
6
|
const path = tslib_1.__importStar(require("path"));
|
|
@@ -28,7 +28,7 @@ const PROXY_SIDECAR_REGISTRIES = {
|
|
|
28
28
|
};
|
|
29
29
|
const isStagingEnvironment = () => process.env.FORGE_GRAPHQL_GATEWAY?.startsWith('https://api-private.stg.atlassian.com/graphql') ?? false;
|
|
30
30
|
const getProxySidecarRegistry = (registryType) => PROXY_SIDECAR_REGISTRIES[registryType][isStagingEnvironment() ? 'staging' : 'production'];
|
|
31
|
-
|
|
31
|
+
const LIFECYCLE_PATTERNS = [
|
|
32
32
|
/Container .* (Starting|Started|Stopping|Stopped|Creating|Created|Recreated)/,
|
|
33
33
|
/Network .* (Creating|Created|Removing|Removed)/,
|
|
34
34
|
/Volume .* (Creating|Created|Removing|Removed)/,
|
|
@@ -217,7 +217,7 @@ const startDockerComposeStack = async (dockerComposeFilePath, serviceKey, logger
|
|
|
217
217
|
await (0, docker_compose_1.pullOne)(PROXY_SIDECAR_SERVICE_NAME, pullOptions);
|
|
218
218
|
}
|
|
219
219
|
catch (ecrRegistryError) {
|
|
220
|
-
throw new DockerUnableToPullProxySidecarImage(new Error(`Initial pull error: ${
|
|
220
|
+
throw new DockerUnableToPullProxySidecarImage(new Error(`Initial pull error: ${getDockerComposeErrorMessage(portableRegistryError)}. Retry error: ${getDockerComposeErrorMessage(ecrRegistryError)}`));
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
await waitForContainersToStart(dockerComposeFilePath, serviceKey, logger);
|
|
@@ -230,7 +230,6 @@ const getDockerComposeErrorMessage = (error) => {
|
|
|
230
230
|
}
|
|
231
231
|
return error != null ? String(error) : 'Unknown Error Occurred.';
|
|
232
232
|
};
|
|
233
|
-
exports.getDockerComposeErrorMessage = getDockerComposeErrorMessage;
|
|
234
233
|
const useEcrProxySidecarImage = (dockerComposeFilePath) => {
|
|
235
234
|
const composeConfig = yaml.parse(fs.readFileSync(dockerComposeFilePath, 'utf8'));
|
|
236
235
|
const proxySidecar = composeConfig?.services?.[PROXY_SIDECAR_SERVICE_NAME];
|
|
@@ -343,7 +342,7 @@ const waitForContainersToStart = async (dockerComposeFilePath, serviceKey, logge
|
|
|
343
342
|
lines.forEach((line) => {
|
|
344
343
|
if (!line.trim())
|
|
345
344
|
return;
|
|
346
|
-
if (
|
|
345
|
+
if (LIFECYCLE_PATTERNS.some((pattern) => pattern.test(line))) {
|
|
347
346
|
logger.info(line);
|
|
348
347
|
}
|
|
349
348
|
});
|
|
@@ -356,7 +355,7 @@ const waitForContainersToStart = async (dockerComposeFilePath, serviceKey, logge
|
|
|
356
355
|
callback: logFilter
|
|
357
356
|
}).catch((error) => {
|
|
358
357
|
clearTimeout(startupTimer);
|
|
359
|
-
reject(new DockerUnableToStartError(new Error(
|
|
358
|
+
reject(new DockerUnableToStartError(new Error(getDockerComposeErrorMessage(error))));
|
|
360
359
|
});
|
|
361
360
|
setTimeout(async () => {
|
|
362
361
|
if (containersStarted)
|
|
@@ -400,7 +399,7 @@ const stopDockerComposeStack = async (configFile, logger, composeFiles) => {
|
|
|
400
399
|
log: false,
|
|
401
400
|
config: file,
|
|
402
401
|
composeOptions: [`-p${serviceKey}`],
|
|
403
|
-
callback: (
|
|
402
|
+
callback: createCustomLogFilter(logger)
|
|
404
403
|
});
|
|
405
404
|
await (0, exports.deleteDockerComposeFile)(file);
|
|
406
405
|
}
|
|
@@ -411,7 +410,7 @@ const stopDockerComposeStack = async (configFile, logger, composeFiles) => {
|
|
|
411
410
|
deleteContainerServiceAssetsDir();
|
|
412
411
|
};
|
|
413
412
|
exports.stopDockerComposeStack = stopDockerComposeStack;
|
|
414
|
-
const
|
|
413
|
+
const createCustomLogFilter = (logger) => {
|
|
415
414
|
let buffer = '';
|
|
416
415
|
return (chunk) => {
|
|
417
416
|
buffer += chunk.toString();
|
|
@@ -420,13 +419,12 @@ const createDockerLifecycleLogFilter = (logger) => {
|
|
|
420
419
|
lines.forEach((line) => {
|
|
421
420
|
if (!line.trim())
|
|
422
421
|
return;
|
|
423
|
-
if (
|
|
422
|
+
if (LIFECYCLE_PATTERNS.some((pattern) => pattern.test(line))) {
|
|
424
423
|
logger.info(line);
|
|
425
424
|
}
|
|
426
425
|
});
|
|
427
426
|
};
|
|
428
427
|
};
|
|
429
|
-
exports.createDockerLifecycleLogFilter = createDockerLifecycleLogFilter;
|
|
430
428
|
const processDockerAuthentication = async (childProcess) => {
|
|
431
429
|
await new Promise((resolve, reject) => {
|
|
432
430
|
childProcess.on('close', (code) => {
|
package/out/tunnel/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tunnel/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tunnel/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC"}
|
package/out/tunnel/index.js
CHANGED
|
@@ -2,5 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./docker-compose-lifecycle"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./compose-project-lifecycle"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./tunnel-options"), exports);
|
|
@@ -8,13 +8,11 @@ export type TunnelCommandOptions = {
|
|
|
8
8
|
verify?: boolean;
|
|
9
9
|
url?: string;
|
|
10
10
|
localPort?: number;
|
|
11
|
-
localStorage?: boolean;
|
|
12
11
|
};
|
|
13
12
|
export type TunnelOptions = Omit<TunnelCommandOptions, 'debugStartingPort'> & {
|
|
14
13
|
debugStartingPort: number;
|
|
15
14
|
assistantName?: string | null;
|
|
16
15
|
containersDockerComposeFiles?: Record<string, string>;
|
|
17
|
-
localStorageCleanup?: () => Promise<void>;
|
|
18
16
|
};
|
|
19
17
|
export declare const defaultDebugStartingPort = 9229;
|
|
20
18
|
export declare const defaultDebugHost = "127.0.0.1";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-options.d.ts","sourceRoot":"","sources":["../../src/tunnel/tunnel-options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qBAAqB,CAAC,EA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AO,CAAC;AAQhE,wBAAsB,cAAc,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAQ1G"}
|
|
@@ -40,7 +40,9 @@ export declare class CommandLineUI implements UI {
|
|
|
40
40
|
private stripHintLine;
|
|
41
41
|
private clearHintTimer;
|
|
42
42
|
private stopHintRotation;
|
|
43
|
-
displayTemporaryMessage<Result>(progress: () => Promise<Result>, waitText: string
|
|
43
|
+
displayTemporaryMessage<Result>(progress: () => Promise<Result>, waitText: string, { animateEllipsis }?: {
|
|
44
|
+
animateEllipsis?: boolean;
|
|
45
|
+
}): Promise<Result>;
|
|
44
46
|
trace(message: string): void;
|
|
45
47
|
debug(message: string): void;
|
|
46
48
|
info(message: string): void;
|
|
@@ -64,11 +66,12 @@ export declare class CommandLineUI implements UI {
|
|
|
64
66
|
promptForSingleChoiceTable(message: string, infoMessage: string, columns: string[], choices: object[]): Promise<number>;
|
|
65
67
|
private getScaledTableHeight;
|
|
66
68
|
private clearLastNLines;
|
|
67
|
-
dynamicTable<Key extends string>(head: [Key, string][], getData: () => Promise<TableData<Key>>, tableRefreshIntervalMs: number, { emptyMessage, preMessage, postMessage, format, groupRows }?: Omit<TableOptions<Key>, 'json'>): Promise<void>;
|
|
68
|
-
table<Key extends string>(head: [Key, string][], data: TableData<Key>, { json, emptyMessage, preMessage, postMessage, format, groupRows, groupKey }?: TableOptions<Key>): void;
|
|
69
|
+
dynamicTable<Key extends string>(head: [Key, string][], getData: () => Promise<TableData<Key>>, tableRefreshIntervalMs: number, { emptyMessage, preMessage, postMessage, format, groupRows, sectionKey, sectionLabel }?: Omit<TableOptions<Key>, 'json'>): Promise<void>;
|
|
70
|
+
table<Key extends string>(head: [Key, string][], data: TableData<Key>, { json, emptyMessage, preMessage, postMessage, format, groupRows, groupKey, sectionKey, sectionLabel }?: TableOptions<Key>): void;
|
|
69
71
|
private formatTableValue;
|
|
70
72
|
private shouldLogTableCell;
|
|
71
73
|
private getTable;
|
|
74
|
+
private getSingleTable;
|
|
72
75
|
private logTable;
|
|
73
76
|
private log;
|
|
74
77
|
private write;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-line-ui.d.ts","sourceRoot":"","sources":["../../src/ui/command-line-ui.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-line-ui.d.ts","sourceRoot":"","sources":["../../src/ui/command-line-ui.ts"],"names":[],"mappings":"AAMA,OAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAQ/B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAIjE,OAAO,EAAW,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAcrE,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,KAAK,SAAS,CAAC,GAAG,SAAS,MAAM,IAAI,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;AAQjF,qBAAa,aAAc,YAAW,EAAE;IAiDpC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAIxB,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IApDxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IAKjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAM;IAE9B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwB;IAGvD,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,mBAAmB,CAAwC;IAEnE,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAQ;IAIhD,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,SAAS,CAA6C;IAI9D,OAAO,CAAC,cAAc,CAAK;IAc3B,OAAO,CAAC,o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AmB;IAmD3B,OAAO,CAAC,wBAAwB;IAMzB,kBAAkB,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAQ1G,oBAAoB,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,UAAO,GAAG,MAAM;CAItF"}
|
|
@@ -4,7 +4,7 @@ exports.CommandLineUI = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
6
|
const tty = tslib_1.__importStar(require("tty"));
|
|
7
|
-
const
|
|
7
|
+
const table_1 = require("./table");
|
|
8
8
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
9
9
|
const inquirer_autocomplete_prompt_1 = tslib_1.__importDefault(require("inquirer-autocomplete-prompt"));
|
|
10
10
|
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
@@ -27,6 +27,8 @@ var ProgressLogType;
|
|
|
27
27
|
function wait(timeMs) {
|
|
28
28
|
return new Promise((resolve) => setTimeout(resolve, timeMs));
|
|
29
29
|
}
|
|
30
|
+
const ELLIPSIS_FRAMES = ['.', '..', '...'];
|
|
31
|
+
const ELLIPSIS_INTERVAL_MS = 400;
|
|
30
32
|
class CommandLineUI {
|
|
31
33
|
verbose;
|
|
32
34
|
customEffectsEnabled;
|
|
@@ -179,16 +181,18 @@ class CommandLineUI {
|
|
|
179
181
|
this.stripHintLine();
|
|
180
182
|
this.hintLine = undefined;
|
|
181
183
|
}
|
|
182
|
-
async displayTemporaryMessage(progress, waitText) {
|
|
184
|
+
async displayTemporaryMessage(progress, waitText, { animateEllipsis = false } = {}) {
|
|
183
185
|
try {
|
|
184
186
|
this.insideProgress = true;
|
|
185
187
|
this.addedProgressPadding = false;
|
|
186
188
|
if (this.debugEnabled) {
|
|
187
|
-
this.log(waitText, ProgressLogType.startText);
|
|
189
|
+
this.log(animateEllipsis ? waitText + ELLIPSIS_FRAMES[ELLIPSIS_FRAMES.length - 1] : waitText, ProgressLogType.startText);
|
|
188
190
|
}
|
|
189
191
|
else {
|
|
190
|
-
this.spinner.spinner =
|
|
191
|
-
|
|
192
|
+
this.spinner.spinner = animateEllipsis
|
|
193
|
+
? { interval: ELLIPSIS_INTERVAL_MS, frames: ELLIPSIS_FRAMES.map((ellipsis) => waitText + ellipsis) }
|
|
194
|
+
: { interval: 9999, frames: [''] };
|
|
195
|
+
this.spinner.prefixText = animateEllipsis ? '' : waitText;
|
|
192
196
|
this.spinner.start();
|
|
193
197
|
}
|
|
194
198
|
const result = await progress();
|
|
@@ -375,7 +379,7 @@ class CommandLineUI {
|
|
|
375
379
|
process.stdout.write(CommandLineUI.ANSI_CLEAR_CURSOR_LINE);
|
|
376
380
|
}
|
|
377
381
|
}
|
|
378
|
-
async dynamicTable(head, getData, tableRefreshIntervalMs, { emptyMessage, preMessage, postMessage, format, groupRows } = {}) {
|
|
382
|
+
async dynamicTable(head, getData, tableRefreshIntervalMs, { emptyMessage, preMessage, postMessage, format, groupRows, sectionKey, sectionLabel } = {}) {
|
|
379
383
|
if (preMessage) {
|
|
380
384
|
this.info(preMessage);
|
|
381
385
|
}
|
|
@@ -397,7 +401,7 @@ class CommandLineUI {
|
|
|
397
401
|
}
|
|
398
402
|
break;
|
|
399
403
|
}
|
|
400
|
-
const table = this.getTable(head, data, { format, groupRows });
|
|
404
|
+
const table = this.getTable(head, data, { format, groupRows, sectionKey, sectionLabel });
|
|
401
405
|
const tableHeight = this.getScaledTableHeight(table);
|
|
402
406
|
this.info(table);
|
|
403
407
|
await wait(tableRefreshIntervalMs);
|
|
@@ -408,7 +412,7 @@ class CommandLineUI {
|
|
|
408
412
|
this.info(postMessage);
|
|
409
413
|
}
|
|
410
414
|
}
|
|
411
|
-
table(head, data, { json, emptyMessage, preMessage, postMessage, format, groupRows, groupKey } = {}) {
|
|
415
|
+
table(head, data, { json, emptyMessage, preMessage, postMessage, format, groupRows, groupKey, sectionKey, sectionLabel } = {}) {
|
|
412
416
|
if (json) {
|
|
413
417
|
this.log(JSON.stringify(data, null, 2));
|
|
414
418
|
return;
|
|
@@ -420,7 +424,7 @@ class CommandLineUI {
|
|
|
420
424
|
if (preMessage) {
|
|
421
425
|
this.info(preMessage);
|
|
422
426
|
}
|
|
423
|
-
this.logTable(head, data, { format, groupRows, groupKey });
|
|
427
|
+
this.logTable(head, data, { format, groupRows, groupKey, sectionKey, sectionLabel });
|
|
424
428
|
if (postMessage) {
|
|
425
429
|
this.info(postMessage);
|
|
426
430
|
}
|
|
@@ -443,8 +447,32 @@ class CommandLineUI {
|
|
|
443
447
|
const prevFormattedValue = this.formatTableValue(key, prevValue, format);
|
|
444
448
|
return formattedValue !== prevFormattedValue;
|
|
445
449
|
}
|
|
446
|
-
getTable(head, data,
|
|
447
|
-
const
|
|
450
|
+
getTable(head, data, options) {
|
|
451
|
+
const { sectionKey, sectionLabel } = options;
|
|
452
|
+
if (!sectionKey) {
|
|
453
|
+
return this.getSingleTable(head, data, options);
|
|
454
|
+
}
|
|
455
|
+
const sections = new Map();
|
|
456
|
+
for (const row of data ?? []) {
|
|
457
|
+
const value = String(row[sectionKey] ?? '');
|
|
458
|
+
const sectionRows = sections.get(value);
|
|
459
|
+
if (sectionRows) {
|
|
460
|
+
sectionRows.push(row);
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
sections.set(value, [row]);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
const sectionHead = head.filter(([key]) => key !== sectionKey);
|
|
467
|
+
return [...sections.entries()]
|
|
468
|
+
.map(([value, sectionRows]) => {
|
|
469
|
+
const label = sectionLabel ? sectionLabel(value) : value;
|
|
470
|
+
return `${label}\n\n${this.getSingleTable(sectionHead, sectionRows, options)}`;
|
|
471
|
+
})
|
|
472
|
+
.join('\n\n');
|
|
473
|
+
}
|
|
474
|
+
getSingleTable(head, data, { format, groupRows, groupKey }) {
|
|
475
|
+
const table = new table_1.ForgeTable({
|
|
448
476
|
...log_color_1.TableStyle.default,
|
|
449
477
|
head: head.map(([, heading]) => heading)
|
|
450
478
|
});
|
|
@@ -473,8 +501,8 @@ class CommandLineUI {
|
|
|
473
501
|
}
|
|
474
502
|
return table.toString();
|
|
475
503
|
}
|
|
476
|
-
logTable(head, data,
|
|
477
|
-
this.info(this.getTable(head, data,
|
|
504
|
+
logTable(head, data, options) {
|
|
505
|
+
this.info(this.getTable(head, data, options));
|
|
478
506
|
}
|
|
479
507
|
log(message, progressLogType = ProgressLogType.other) {
|
|
480
508
|
this.write('log', message, progressLogType);
|
package/out/ui/index.d.ts
CHANGED
package/out/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAEA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAEA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC"}
|
package/out/ui/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-prompt.d.ts","sourceRoot":"","sources":["../../src/ui/table-prompt.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"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AAO,CAAK;IACpB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,kBAAkB,CAAU;IACpC,OAAO,CAAC,YAAY,CAAU;gBAElB,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG;IAavD,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;IAQnC,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,UAAU;IAKlB,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAEhE,OAAO,CAAC,QAAQ;IAMhB,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAE9D,OAAO,CAAC,MAAM;IAad,SAAS,CAAC,WAAW,CACnB,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,gBAAgB,EACpD,YAAY,EAAE,gBAAgB,EAC9B,SAAS,EAAE,kBAAkB,EAC7B,UAAU,EAAE,cAAc,GACzB,MAAM;IAoBT,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;CACzD"}
|
package/out/ui/table-prompt.js
CHANGED
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const base_1 = tslib_1.__importDefault(require("inquirer/lib/prompts/base"));
|
|
6
6
|
const events_1 = tslib_1.__importDefault(require("inquirer/lib/utils/events"));
|
|
7
7
|
const readline_1 = tslib_1.__importDefault(require("inquirer/lib/utils/readline"));
|
|
8
|
-
const
|
|
8
|
+
const table_1 = require("./table");
|
|
9
9
|
const text_1 = require("./text");
|
|
10
10
|
const NO_BORDERS = {
|
|
11
11
|
top: '',
|
|
@@ -93,7 +93,7 @@ class TablePrompt extends base_1.default {
|
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
renderTable({ pointer, columns, rows, isDone }, getRowSymbol, formatRow, isSelected) {
|
|
96
|
-
const table = new
|
|
96
|
+
const table = new table_1.ForgeTable({
|
|
97
97
|
head: [...columns],
|
|
98
98
|
style: { head: [] },
|
|
99
99
|
chars: this.isBorderless ? NO_BORDERS : {}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Table, { TableConstructorOptions } from 'cli-table3';
|
|
2
|
+
export declare class ForgeTable extends Table {
|
|
3
|
+
private readonly debugEnabled;
|
|
4
|
+
constructor(options?: TableConstructorOptions & {
|
|
5
|
+
debug?: boolean | number | string;
|
|
6
|
+
});
|
|
7
|
+
toString(): string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/ui/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAoD5D,qBAAa,UAAW,SAAQ,KAAK;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;gBAE3B,OAAO,GAAE,uBAAuB,GAAG;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;KAAO;IAKlF,QAAQ,IAAI,MAAM;CAW1B"}
|
package/out/ui/table.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ForgeTable = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cli_table3_1 = tslib_1.__importDefault(require("cli-table3"));
|
|
6
|
+
function loadCell() {
|
|
7
|
+
try {
|
|
8
|
+
const version = require('cli-table3/package.json').version;
|
|
9
|
+
return version === '0.6.5' ? require('cli-table3/src/cell') : undefined;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const Cell = loadCell();
|
|
16
|
+
const originalDraw = Cell?.prototype.draw;
|
|
17
|
+
function drawWithoutDebug(line, spanningCell) {
|
|
18
|
+
if (line === 'top')
|
|
19
|
+
return this.drawTop(this.drawRight);
|
|
20
|
+
if (line === 'bottom')
|
|
21
|
+
return this.drawBottom(this.drawRight);
|
|
22
|
+
const padding = Math.max(this.height - this.lines.length, 0);
|
|
23
|
+
let paddingTop = 0;
|
|
24
|
+
switch (this.vAlign) {
|
|
25
|
+
case 'center':
|
|
26
|
+
paddingTop = Math.ceil(padding / 2);
|
|
27
|
+
break;
|
|
28
|
+
case 'bottom':
|
|
29
|
+
paddingTop = padding;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
if (line < paddingTop || line >= paddingTop + this.lines.length) {
|
|
33
|
+
return this.drawEmpty(this.drawRight, spanningCell);
|
|
34
|
+
}
|
|
35
|
+
const truncate = this.lines.length > this.height && line + 1 >= this.height;
|
|
36
|
+
return this.drawLine(line - paddingTop, this.drawRight, truncate, spanningCell);
|
|
37
|
+
}
|
|
38
|
+
class ForgeTable extends cli_table3_1.default {
|
|
39
|
+
debugEnabled;
|
|
40
|
+
constructor(options = {}) {
|
|
41
|
+
super(options);
|
|
42
|
+
this.debugEnabled = Boolean(options.debug);
|
|
43
|
+
}
|
|
44
|
+
toString() {
|
|
45
|
+
if (!Cell || !originalDraw)
|
|
46
|
+
return super.toString();
|
|
47
|
+
const previousDraw = Cell.prototype.draw;
|
|
48
|
+
Cell.prototype.draw = this.debugEnabled ? originalDraw : drawWithoutDebug;
|
|
49
|
+
try {
|
|
50
|
+
return super.toString();
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
Cell.prototype.draw = previousDraw;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.ForgeTable = ForgeTable;
|