@portaidentity/cli 1.3.0 → 1.3.1
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/dist/commands/version.d.ts +1 -1
- package/dist/commands/version.js +1 -1
- package/dist/output.d.ts +4 -4
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +6 -70
- package/dist/output.js.map +1 -1
- package/package.json +2 -2
|
@@ -17,7 +17,7 @@ import type { GlobalOptions } from '../global-options.js';
|
|
|
17
17
|
* CLI version — read from package.json at build time.
|
|
18
18
|
* This must be kept in sync with package.json version.
|
|
19
19
|
*/
|
|
20
|
-
export declare const CLI_VERSION = "1.
|
|
20
|
+
export declare const CLI_VERSION = "1.3.0";
|
|
21
21
|
/**
|
|
22
22
|
* The version command module — shows version info for CLI, SDK, and server.
|
|
23
23
|
*/
|
package/dist/commands/version.js
CHANGED
|
@@ -22,7 +22,7 @@ import { fetchHealthStatus } from '../auth/metadata.js';
|
|
|
22
22
|
* CLI version — read from package.json at build time.
|
|
23
23
|
* This must be kept in sync with package.json version.
|
|
24
24
|
*/
|
|
25
|
-
export const CLI_VERSION = '1.
|
|
25
|
+
export const CLI_VERSION = '1.3.0';
|
|
26
26
|
// ---------------------------------------------------------------------------
|
|
27
27
|
// Command Definition
|
|
28
28
|
// ---------------------------------------------------------------------------
|
package/dist/output.d.ts
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
* Formats data as a table and prints to stdout.
|
|
16
16
|
*
|
|
17
17
|
* Creates a cli-table3 instance with bold headers and prints each row. Cell
|
|
18
|
-
* values are NEVER truncated
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* values are NEVER truncated or wrapped: the table auto-sizes to its full
|
|
19
|
+
* content so values (including full UUIDs) always print intact and remain
|
|
20
|
+
* copy-pasteable. When the table is wider than the terminal it scrolls
|
|
21
|
+
* horizontally, the same as standard CLI tools (e.g. `docker ps`).
|
|
22
22
|
*
|
|
23
23
|
* @param headers - Column header labels (will be bold)
|
|
24
24
|
* @param rows - Array of row data (each row is an array of cell strings)
|
package/dist/output.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI,CAMpE;AAGD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAIzE;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,SAAK,GAAG,MAAM,CAGzD"}
|
package/dist/output.js
CHANGED
|
@@ -13,86 +13,22 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import Table from 'cli-table3';
|
|
15
15
|
import chalk from 'chalk';
|
|
16
|
-
/** Matches ANSI SGR escape sequences (e.g. chalk colors) for length measurement. */
|
|
17
|
-
// eslint-disable-next-line no-control-regex
|
|
18
|
-
const ANSI_PATTERN = /\u001b\[[0-9;]*m/g;
|
|
19
|
-
/** Returns the visible length of a string, ignoring ANSI color codes. */
|
|
20
|
-
function visibleLength(value) {
|
|
21
|
-
return value.replace(ANSI_PATTERN, '').length;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Computes per-column widths so that long cell values wrap within the table
|
|
25
|
-
* instead of overflowing the terminal — without ever dropping characters.
|
|
26
|
-
*
|
|
27
|
-
* Returns `undefined` when the table's natural width already fits the terminal
|
|
28
|
-
* (let cli-table3 auto-size to content). When the natural width exceeds the
|
|
29
|
-
* terminal, column widths are allocated proportionally to their content so the
|
|
30
|
-
* table box stays intact and `wordWrap` wraps the overflow.
|
|
31
|
-
*
|
|
32
|
-
* @param headers - Column header labels
|
|
33
|
-
* @param rows - Row data
|
|
34
|
-
* @param terminalWidth - Available terminal columns
|
|
35
|
-
* @returns Array of cli-table3 column widths (content + padding), or undefined
|
|
36
|
-
*/
|
|
37
|
-
function computeColumnWidths(headers, rows, terminalWidth) {
|
|
38
|
-
const numCols = headers.length;
|
|
39
|
-
if (numCols === 0)
|
|
40
|
-
return undefined;
|
|
41
|
-
// Natural content width per column = widest visible value (header or cell).
|
|
42
|
-
const natural = headers.map((header, i) => {
|
|
43
|
-
let max = visibleLength(header);
|
|
44
|
-
for (const row of rows) {
|
|
45
|
-
max = Math.max(max, visibleLength(String(row[i] ?? '')));
|
|
46
|
-
}
|
|
47
|
-
return max;
|
|
48
|
-
});
|
|
49
|
-
// cli-table3 layout: each column adds 2 chars of padding; borders add numCols+1.
|
|
50
|
-
const paddingPerCol = 2;
|
|
51
|
-
const borders = numCols + 1;
|
|
52
|
-
const naturalTotal = natural.reduce((sum, w) => sum + w + paddingPerCol, 0) + borders;
|
|
53
|
-
// Already fits — let the table size itself to the full content.
|
|
54
|
-
if (naturalTotal <= terminalWidth)
|
|
55
|
-
return undefined;
|
|
56
|
-
const minContent = 6;
|
|
57
|
-
const overhead = numCols * paddingPerCol + borders;
|
|
58
|
-
const available = terminalWidth - overhead;
|
|
59
|
-
// Terminal too narrow even for minimums — give every column the minimum.
|
|
60
|
-
if (available < numCols * minContent) {
|
|
61
|
-
return natural.map(() => minContent + paddingPerCol);
|
|
62
|
-
}
|
|
63
|
-
const naturalContentTotal = natural.reduce((a, b) => a + b, 0) || 1;
|
|
64
|
-
return natural.map((w) => {
|
|
65
|
-
const allocated = Math.max(minContent, Math.floor((w / naturalContentTotal) * available));
|
|
66
|
-
return allocated + paddingPerCol;
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
16
|
/**
|
|
70
17
|
* Formats data as a table and prints to stdout.
|
|
71
18
|
*
|
|
72
19
|
* Creates a cli-table3 instance with bold headers and prints each row. Cell
|
|
73
|
-
* values are NEVER truncated
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
20
|
+
* values are NEVER truncated or wrapped: the table auto-sizes to its full
|
|
21
|
+
* content so values (including full UUIDs) always print intact and remain
|
|
22
|
+
* copy-pasteable. When the table is wider than the terminal it scrolls
|
|
23
|
+
* horizontally, the same as standard CLI tools (e.g. `docker ps`).
|
|
77
24
|
*
|
|
78
25
|
* @param headers - Column header labels (will be bold)
|
|
79
26
|
* @param rows - Array of row data (each row is an array of cell strings)
|
|
80
27
|
*/
|
|
81
28
|
export function printTable(headers, rows) {
|
|
82
|
-
const
|
|
29
|
+
const table = new Table({
|
|
83
30
|
head: headers.map((h) => chalk.bold(h)),
|
|
84
|
-
};
|
|
85
|
-
const terminalWidth = process.stdout.columns;
|
|
86
|
-
if (terminalWidth && terminalWidth > 0) {
|
|
87
|
-
const colWidths = computeColumnWidths(headers, rows, terminalWidth);
|
|
88
|
-
if (colWidths) {
|
|
89
|
-
options.colWidths = colWidths;
|
|
90
|
-
options.wordWrap = true;
|
|
91
|
-
// Wrap long unbroken tokens (e.g. UUIDs) by character, not word boundary.
|
|
92
|
-
options.wrapOnWordBoundary = false;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const table = new Table(options);
|
|
31
|
+
});
|
|
96
32
|
rows.forEach((row) => table.push(row));
|
|
97
33
|
console.log(table.toString());
|
|
98
34
|
}
|
package/dist/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,OAAiB,EAAE,IAAgB;IAC5D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC;QACtB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACxC,CAAC,CAAC;IACH,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;AAChC,CAAC;AAGD;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,IAAa;IACrC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAe;IACrC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,OAAe;IACnC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,IAAsC;IAC/D,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,CAAC,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,OAAO,CAAC,CAAC,cAAc,EAAE,CAAC;AAC5B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,MAAM,GAAG,EAAE;IAC/C,IAAI,GAAG,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,GAAG,CAAC;IACrC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portaidentity/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Standalone CLI for the Porta Identity Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"clean": "rm -rf dist"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@portaidentity/sdk": "1.3.
|
|
22
|
+
"@portaidentity/sdk": "1.3.1",
|
|
23
23
|
"chalk": "^5.6.2",
|
|
24
24
|
"cli-table3": "^0.6.5",
|
|
25
25
|
"jose": "^6.2.3",
|