zinkee 0.1.38 → 0.1.40
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/index.js +213 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/automations.ts +1 -0
- package/src/api/displays.ts +1 -0
- package/src/api/schemas.ts +1 -0
- package/src/commands/automations.ts +3 -3
- package/src/commands/displays.test.ts +141 -0
- package/src/commands/displays.ts +149 -2
- package/src/commands/schemas.ts +3 -2
- package/src/utils/examples.test.ts +2 -0
- package/src/utils/examples.ts +108 -4
- package/src/utils/output.test.ts +27 -1
- package/src/utils/output.ts +30 -0
package/src/utils/output.ts
CHANGED
|
@@ -59,6 +59,36 @@ export function buildTableColumns(keys: readonly string[]): readonly TableColumn
|
|
|
59
59
|
return keys.map((key) => ({ key, label: key }));
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
export interface FolderLocation {
|
|
63
|
+
id?: string;
|
|
64
|
+
name?: string | null;
|
|
65
|
+
isRoot?: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Column keys, in order, produced by {@link folderColumns}. Append them to a table's key list. */
|
|
69
|
+
export const FOLDER_TABLE_KEYS = ["folderId", "folderName", "folderIsRoot"] as const;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Flattens the API `folder` object (`{ id, name, isRoot }`) into the folderId/folderName/folderIsRoot table columns.
|
|
73
|
+
* The root folder arrives with a null name, so folderName renders it as "(root)". A missing folder (e.g. a workspace
|
|
74
|
+
* without a default group) leaves every column empty.
|
|
75
|
+
*/
|
|
76
|
+
export function folderColumns(folder: FolderLocation | null | undefined): {
|
|
77
|
+
folderId: string;
|
|
78
|
+
folderName: string;
|
|
79
|
+
folderIsRoot: string;
|
|
80
|
+
} {
|
|
81
|
+
if (!folder) {
|
|
82
|
+
return { folderId: "", folderName: "", folderIsRoot: "" };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
folderId: folder.id ?? "",
|
|
87
|
+
folderName: folder.name ?? (folder.isRoot === true ? "(root)" : ""),
|
|
88
|
+
folderIsRoot: folder.isRoot === undefined ? "" : String(folder.isRoot),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
62
92
|
export function buildTableRows(
|
|
63
93
|
rows: readonly Record<string, unknown>[],
|
|
64
94
|
columns: readonly TableColumn[],
|