@uipath/insights-tool 1.204.0 → 1.205.0-preview.258
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/{dashboard-copy-s0bdw3dm.js → dashboard-copy-g9ce8723.js} +2 -2
- package/dist/{dashboard-delete-szc4n538.js → dashboard-delete-fs1g09wd.js} +3 -3
- package/dist/{dashboard-update-v1f117xg.js → dashboard-update-9yherpew.js} +2 -2
- package/dist/{export-configurations-p64eb445.js → export-configurations-s1c7q6bt.js} +2 -2
- package/dist/index.js +5 -5
- package/dist/{tool-pjh955qc.js → tool-751bt6xf.js} +1 -1
- package/dist/{tool-1ajpjrv3.js → tool-bpkdemsh.js} +402 -18
- package/dist/{tool-dpkb9gc4.js → tool-dha9dpb9.js} +7 -3
- package/dist/{tool-r32j3rq9.js → tool-hkc3xm98.js} +368 -32
- package/dist/{tool-3fs6wz16.js → tool-sy0dv0f1.js} +1 -1
- package/dist/tool.js +5 -5
- package/package.json +2 -2
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
slotReadCommand,
|
|
20
20
|
writeDashboardGetError,
|
|
21
21
|
writeSlotOccupied
|
|
22
|
-
} from "./tool-
|
|
22
|
+
} from "./tool-dha9dpb9.js";
|
|
23
23
|
import {
|
|
24
24
|
InsightsHttpError,
|
|
25
25
|
MAESTRO_DASHBOARD_SOURCE_TYPE,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
getFileSystem,
|
|
31
31
|
resolveInsightsConfig,
|
|
32
32
|
writeInsightsFailure
|
|
33
|
-
} from "./tool-
|
|
33
|
+
} from "./tool-hkc3xm98.js";
|
|
34
34
|
import"./tool-1de529jm.js";
|
|
35
35
|
|
|
36
36
|
// src/utils/dashboard-copy.ts
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ALERTS_FAMILY,
|
|
3
3
|
AlertContractError,
|
|
4
4
|
projectAlertDefinition
|
|
5
|
-
} from "./tool-
|
|
5
|
+
} from "./tool-751bt6xf.js";
|
|
6
6
|
import {
|
|
7
7
|
DASHBOARDS_FAMILY,
|
|
8
8
|
caseFlag,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
writeJsonFile,
|
|
20
20
|
writeReadBackFailed,
|
|
21
21
|
writeUnknownWriteOutcome
|
|
22
|
-
} from "./tool-
|
|
22
|
+
} from "./tool-dha9dpb9.js";
|
|
23
23
|
import {
|
|
24
24
|
DASHBOARD_NOT_FOUND_LABEL,
|
|
25
25
|
DASHBOARD_SLOT_DELIMITER,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
writeInsightsError,
|
|
44
44
|
writeInsightsFailure,
|
|
45
45
|
writeNetworkFailure
|
|
46
|
-
} from "./tool-
|
|
46
|
+
} from "./tool-hkc3xm98.js";
|
|
47
47
|
import"./tool-1de529jm.js";
|
|
48
48
|
|
|
49
49
|
// src/utils/dashboard-delete.ts
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
writeJsonFile,
|
|
21
21
|
writeReadBackFailed,
|
|
22
22
|
writeUnknownWriteOutcome
|
|
23
|
-
} from "./tool-
|
|
23
|
+
} from "./tool-dha9dpb9.js";
|
|
24
24
|
import {
|
|
25
25
|
DashboardRequestError,
|
|
26
26
|
InsightsHttpError,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
writeInsightsError,
|
|
39
39
|
writeInsightsFailure,
|
|
40
40
|
writeNetworkFailure
|
|
41
|
-
} from "./tool-
|
|
41
|
+
} from "./tool-hkc3xm98.js";
|
|
42
42
|
import"./tool-1de529jm.js";
|
|
43
43
|
|
|
44
44
|
// src/utils/dashboard-update.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
unwrapPortalEnvelope
|
|
3
|
-
} from "./tool-
|
|
3
|
+
} from "./tool-sy0dv0f1.js";
|
|
4
4
|
import {
|
|
5
5
|
OutputFormatter,
|
|
6
6
|
RESULTS,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
verifyExportDestination,
|
|
22
22
|
writeInsightsError,
|
|
23
23
|
writeInsightsFailure
|
|
24
|
-
} from "./tool-
|
|
24
|
+
} from "./tool-hkc3xm98.js";
|
|
25
25
|
import"./tool-1de529jm.js";
|
|
26
26
|
|
|
27
27
|
// src/utils/export-configurations.ts
|
package/dist/index.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
metadata,
|
|
4
4
|
registerCommands
|
|
5
|
-
} from "./tool-
|
|
6
|
-
import"./tool-
|
|
5
|
+
} from "./tool-bpkdemsh.js";
|
|
6
|
+
import"./tool-751bt6xf.js";
|
|
7
7
|
import"./tool-fqh66108.js";
|
|
8
|
-
import"./tool-
|
|
9
|
-
import"./tool-
|
|
8
|
+
import"./tool-sy0dv0f1.js";
|
|
9
|
+
import"./tool-dha9dpb9.js";
|
|
10
10
|
import {
|
|
11
11
|
Command
|
|
12
|
-
} from "./tool-
|
|
12
|
+
} from "./tool-hkc3xm98.js";
|
|
13
13
|
import"./tool-1de529jm.js";
|
|
14
14
|
|
|
15
15
|
// src/index.ts
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
executeAlertsList,
|
|
7
7
|
executeCheckEntitlement,
|
|
8
8
|
parseRouteId
|
|
9
|
-
} from "./tool-
|
|
9
|
+
} from "./tool-751bt6xf.js";
|
|
10
10
|
import {
|
|
11
11
|
FROM_PROCESS_KEY_FLAG,
|
|
12
12
|
TO_PROCESS_KEY_FLAG
|
|
13
13
|
} from "./tool-fqh66108.js";
|
|
14
14
|
import {
|
|
15
15
|
unwrapPortalEnvelope
|
|
16
|
-
} from "./tool-
|
|
16
|
+
} from "./tool-sy0dv0f1.js";
|
|
17
17
|
import {
|
|
18
18
|
CHART_TYPES,
|
|
19
19
|
DEFINITION_FILE_RECOVERY,
|
|
@@ -28,13 +28,21 @@ import {
|
|
|
28
28
|
trimDashboardId,
|
|
29
29
|
trimOption,
|
|
30
30
|
validateTimeSelection
|
|
31
|
-
} from "./tool-
|
|
31
|
+
} from "./tool-dha9dpb9.js";
|
|
32
32
|
import {
|
|
33
|
+
EMPTY_LIST_NOTE,
|
|
33
34
|
FOLDER_LOOKUP_NOT_FOUND_INSTRUCTIONS,
|
|
35
|
+
LOOKER_FOLDERS,
|
|
36
|
+
LOOKER_NO_DASHBOARDS_MESSAGE,
|
|
37
|
+
LOOKER_THEMES,
|
|
38
|
+
LOOKER_USER_UNAVAILABLE_MESSAGE,
|
|
39
|
+
LookerResolveError,
|
|
34
40
|
MAESTRO_DASHBOARD_SOURCE_TYPE,
|
|
35
41
|
Option,
|
|
36
42
|
OutputFormatter,
|
|
43
|
+
PORTAL_ERROR_CODE,
|
|
37
44
|
RESULTS,
|
|
45
|
+
RETRY_LATER_INSTRUCTIONS,
|
|
38
46
|
addMonitoringTimeOptions,
|
|
39
47
|
asRecord,
|
|
40
48
|
bindInsightsQuery,
|
|
@@ -42,6 +50,7 @@ import {
|
|
|
42
50
|
byRowKeys,
|
|
43
51
|
catchError,
|
|
44
52
|
claimGatedSurface404,
|
|
53
|
+
claimHttpError,
|
|
45
54
|
compareRowKeys,
|
|
46
55
|
composeDashboardSlotId,
|
|
47
56
|
createContractGuards,
|
|
@@ -51,6 +60,7 @@ import {
|
|
|
51
60
|
executeInsightsList,
|
|
52
61
|
failValidation,
|
|
53
62
|
getGroup,
|
|
63
|
+
getLookerDashboardEmbedUrl,
|
|
54
64
|
getMachineAvailabilityTimeline,
|
|
55
65
|
getMachineDetails,
|
|
56
66
|
getMachineRuntimeMix,
|
|
@@ -70,10 +80,13 @@ import {
|
|
|
70
80
|
getUser,
|
|
71
81
|
insightsPost,
|
|
72
82
|
isGuid,
|
|
83
|
+
isLookerTemplateDashboardId,
|
|
84
|
+
joinParts,
|
|
73
85
|
listAgenticAlertDefinitions,
|
|
74
86
|
listAlertDefinitions,
|
|
75
87
|
listFolderFilters,
|
|
76
88
|
listGroups,
|
|
89
|
+
listLookerDashboards,
|
|
77
90
|
listMachineFilters,
|
|
78
91
|
listProcessFilters,
|
|
79
92
|
listQueueFilters,
|
|
@@ -85,14 +98,21 @@ import {
|
|
|
85
98
|
pagingCostNote,
|
|
86
99
|
parseBoundedInt,
|
|
87
100
|
parseLimit,
|
|
101
|
+
parseLookerEnvelope,
|
|
88
102
|
parseOffset,
|
|
89
103
|
pickScalar,
|
|
90
104
|
preserveBackendOrder,
|
|
91
105
|
processContext,
|
|
106
|
+
readLookerListing,
|
|
107
|
+
resolveInsightsConfig,
|
|
108
|
+
resolveLookerDashboard,
|
|
92
109
|
truncatedNote,
|
|
93
110
|
validateMonitoringTime,
|
|
94
|
-
|
|
95
|
-
|
|
111
|
+
writeInsightsError,
|
|
112
|
+
writeInsightsFailure,
|
|
113
|
+
writeInsightsNotFound,
|
|
114
|
+
writePortalProvisioningNotFound
|
|
115
|
+
} from "./tool-hkc3xm98.js";
|
|
96
116
|
import {
|
|
97
117
|
__require
|
|
98
118
|
} from "./tool-1de529jm.js";
|
|
@@ -101,7 +121,7 @@ var package_default = {
|
|
|
101
121
|
name: "@uipath/insights-tool",
|
|
102
122
|
author: "UiPath",
|
|
103
123
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
104
|
-
version: "1.
|
|
124
|
+
version: "1.205.0-preview.258",
|
|
105
125
|
description: "Query UiPath Insights data — jobs, failures, and performance metrics.",
|
|
106
126
|
private: false,
|
|
107
127
|
repository: {
|
|
@@ -425,7 +445,7 @@ function registerDashboardsCommand(program) {
|
|
|
425
445
|
if (options.expectedVersion === undefined) {
|
|
426
446
|
return failValidation("Missing required field: --expected-version.", "Pass the version 'uip insights dashboards get --process-key <guid>' reported for this dashboard.");
|
|
427
447
|
}
|
|
428
|
-
const { executeDashboardUpdate } = await import("./dashboard-update-
|
|
448
|
+
const { executeDashboardUpdate } = await import("./dashboard-update-9yherpew.js");
|
|
429
449
|
await executeDashboardUpdate({
|
|
430
450
|
target,
|
|
431
451
|
file,
|
|
@@ -442,7 +462,7 @@ function registerDashboardsCommand(program) {
|
|
|
442
462
|
if (backupFile === undefined) {
|
|
443
463
|
return;
|
|
444
464
|
}
|
|
445
|
-
const { executeDashboardDelete } = await import("./dashboard-delete-
|
|
465
|
+
const { executeDashboardDelete } = await import("./dashboard-delete-fs1g09wd.js");
|
|
446
466
|
await executeDashboardDelete({
|
|
447
467
|
target,
|
|
448
468
|
yes: options.yes,
|
|
@@ -465,7 +485,7 @@ function registerDashboardsCommand(program) {
|
|
|
465
485
|
if (outputFile === undefined) {
|
|
466
486
|
return;
|
|
467
487
|
}
|
|
468
|
-
const { executeDashboardCopy } = await import("./dashboard-copy-
|
|
488
|
+
const { executeDashboardCopy } = await import("./dashboard-copy-g9ce8723.js");
|
|
469
489
|
await executeDashboardCopy({
|
|
470
490
|
from,
|
|
471
491
|
to,
|
|
@@ -478,7 +498,7 @@ function registerDashboardsCommand(program) {
|
|
|
478
498
|
function registerExportConfigurationsCommand(program) {
|
|
479
499
|
const exportCmd = program.command("export-configurations").description("Read UiPath Insights unified export configurations and check their destinations");
|
|
480
500
|
exportCmd.command("verify").description("Have Insights test the organization's Azure Event Hub and AWS SQS export destinations with the credentials it has stored; other types come back unprobed. Omit the ID to check every configuration").argument("[configuration-id]", "Export configuration ID (integer); omit to check every configuration except Splunk HEC and unmigrated rows", parseRouteId("[configuration-id]")).trackedAction(processContext, async (configurationId) => {
|
|
481
|
-
const { executeExportVerifyAll, executeExportVerifyOne } = await import("./export-configurations-
|
|
501
|
+
const { executeExportVerifyAll, executeExportVerifyOne } = await import("./export-configurations-s1c7q6bt.js");
|
|
482
502
|
if (configurationId === undefined) {
|
|
483
503
|
await executeExportVerifyAll();
|
|
484
504
|
return;
|
|
@@ -486,7 +506,7 @@ function registerExportConfigurationsCommand(program) {
|
|
|
486
506
|
await executeExportVerifyOne(String(configurationId));
|
|
487
507
|
});
|
|
488
508
|
addListPaginationOptions(exportCmd.command("list").description("List the organization's unified export configurations; rows carry no connection string, access key or API key")).trackedAction(processContext, async (options) => {
|
|
489
|
-
const { executeExportConfigurationsList } = await import("./export-configurations-
|
|
509
|
+
const { executeExportConfigurationsList } = await import("./export-configurations-s1c7q6bt.js");
|
|
490
510
|
await executeExportConfigurationsList(options);
|
|
491
511
|
});
|
|
492
512
|
}
|
|
@@ -629,7 +649,6 @@ function rbacFamily(subject, notFoundExtra = "") {
|
|
|
629
649
|
isContractError: (error) => error instanceof RbacContractError
|
|
630
650
|
};
|
|
631
651
|
}
|
|
632
|
-
var EMPTY_LIST_SUFFIX = "An empty list is a successful result, not an error.";
|
|
633
652
|
function unwrapPortalBody(raw, subject) {
|
|
634
653
|
return unwrapPortalEnvelope(raw, subject, (message) => new RbacContractError(message));
|
|
635
654
|
}
|
|
@@ -736,12 +755,9 @@ function compareRbacRows(a, b) {
|
|
|
736
755
|
}
|
|
737
756
|
return compareRowKeys(JSON.stringify(a.row), JSON.stringify(b.row));
|
|
738
757
|
}
|
|
739
|
-
function joinParts(parts) {
|
|
740
|
-
return parts.filter((part) => part !== "").join(" ");
|
|
741
|
-
}
|
|
742
758
|
function buildListInstructions(spec, total, returned, hasMore, full) {
|
|
743
759
|
if (total === 0) {
|
|
744
|
-
return joinParts([spec.emptyNote,
|
|
760
|
+
return joinParts([spec.emptyNote, EMPTY_LIST_NOTE]);
|
|
745
761
|
}
|
|
746
762
|
const withheld = full ? "" : spec.withheldNote;
|
|
747
763
|
if (returned === 0) {
|
|
@@ -760,7 +776,7 @@ function writeRbacGetNotFound(error, family, id) {
|
|
|
760
776
|
]));
|
|
761
777
|
}
|
|
762
778
|
function writeRbacListNotFound(error, subject) {
|
|
763
|
-
|
|
779
|
+
writePortalProvisioningNotFound(error, `The Insights ${subject} list returned HTTP 404.`);
|
|
764
780
|
}
|
|
765
781
|
async function executeRbacList(options, fetchList, family, spec, full) {
|
|
766
782
|
await executeInsightsList(options, fetchList, {
|
|
@@ -937,6 +953,373 @@ function registerJobsCommand(program) {
|
|
|
937
953
|
});
|
|
938
954
|
}
|
|
939
955
|
|
|
956
|
+
// src/utils/looker-result.ts
|
|
957
|
+
class LookerContractError extends Error {
|
|
958
|
+
constructor(message) {
|
|
959
|
+
super(message);
|
|
960
|
+
this.name = "LookerContractError";
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
function requireEmbedResult(result) {
|
|
964
|
+
const dto = asRecord(result);
|
|
965
|
+
if (!dto) {
|
|
966
|
+
throw new LookerContractError("Insights returned a Looker dashboard embed result that is not an object");
|
|
967
|
+
}
|
|
968
|
+
if (typeof dto.url !== "string" || dto.url === "") {
|
|
969
|
+
throw new LookerContractError("Insights returned a Looker dashboard embed result whose url is not a non-empty string");
|
|
970
|
+
}
|
|
971
|
+
if (!isHttpsUrl(dto.url)) {
|
|
972
|
+
throw new LookerContractError("Insights returned a Looker dashboard embed result whose url is not an https URL");
|
|
973
|
+
}
|
|
974
|
+
if (typeof dto.folderPermissionsSuccess !== "boolean") {
|
|
975
|
+
throw new LookerContractError("Insights returned a Looker dashboard embed result whose folderPermissionsSuccess is not a boolean");
|
|
976
|
+
}
|
|
977
|
+
return {
|
|
978
|
+
url: dto.url,
|
|
979
|
+
folderPermissionsSuccess: dto.folderPermissionsSuccess
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
function isHttpsUrl(value) {
|
|
983
|
+
const [error, url] = catchError(() => new URL(value));
|
|
984
|
+
return !error && url.protocol === "https:";
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
// src/utils/looker-dashboards.ts
|
|
988
|
+
var LOOKER_FAMILY = {
|
|
989
|
+
subject: "Looker Dashboard",
|
|
990
|
+
service: "portal",
|
|
991
|
+
forbiddenExtra: "",
|
|
992
|
+
isContractError: (error) => error instanceof LookerContractError
|
|
993
|
+
};
|
|
994
|
+
function claimLookerError(writers) {
|
|
995
|
+
return (error) => {
|
|
996
|
+
if (error.status === 404) {
|
|
997
|
+
writeLookerProvisioningNotFound(error);
|
|
998
|
+
return true;
|
|
999
|
+
}
|
|
1000
|
+
const code = error.bodyHint?.portalErrorCode;
|
|
1001
|
+
if (code === undefined) {
|
|
1002
|
+
return false;
|
|
1003
|
+
}
|
|
1004
|
+
const write = writers[`${error.status}:${code}`];
|
|
1005
|
+
if (write === undefined) {
|
|
1006
|
+
return false;
|
|
1007
|
+
}
|
|
1008
|
+
write(error);
|
|
1009
|
+
return true;
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
function writeLookerProvisioningNotFound(error) {
|
|
1013
|
+
writePortalProvisioningNotFound(error, "The Insights Looker Dashboard routes returned HTTP 404.");
|
|
1014
|
+
}
|
|
1015
|
+
var LOOKER_ID_SPACE_NOTE = "These are Looker-era dashboards; their ids work on 'uip insights looker-dashboards' commands only.";
|
|
1016
|
+
var LIST_CACHE_NOTE = "The backend caches each folder for up to an hour, so a listed dashboard may already be deleted.";
|
|
1017
|
+
var LIST_COMMAND = "'uip insights looker-dashboards list'";
|
|
1018
|
+
var PERSONAL_FOLDER_AUDIENCE = "only for a session with Insights Dashboard Edit whose Looker user has a personal folder";
|
|
1019
|
+
var PERSONAL_OMITTED_NOTE = `Personal folder omitted: Insights lists it ${PERSONAL_FOLDER_AUDIENCE}, and one of those is missing here.`;
|
|
1020
|
+
function joinNames(names) {
|
|
1021
|
+
if (names.length <= 2) {
|
|
1022
|
+
return names.join(" and ");
|
|
1023
|
+
}
|
|
1024
|
+
return `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
|
|
1025
|
+
}
|
|
1026
|
+
function omittedFoldersNote(folders) {
|
|
1027
|
+
if (folders.length === 0) {
|
|
1028
|
+
return "";
|
|
1029
|
+
}
|
|
1030
|
+
const noun = folders.length === 1 ? "folder" : "folders";
|
|
1031
|
+
return `The ${joinNames(folders)} ${noun} answered null rather than an empty folder, which means Insights has no Looker folder provisioned there for this tenant.`;
|
|
1032
|
+
}
|
|
1033
|
+
var LIST_PAGING_COST_NOTE = pagingCostNote("Looker Dashboard");
|
|
1034
|
+
var EMBED_CREDENTIAL_NOTE = "The URL is a signed, single-user Looker embed link that carries the caller's identity in its query string; put it in an iframe or open it directly, do not store, log or share it, and request a new one for each page load.";
|
|
1035
|
+
var EMBED_SESSION_NOTE = "The embed session it opens is bounded by the Insights service (twenty hours at the source read), and the dashboard renders with the caller's own Insights permissions and folder visibility.";
|
|
1036
|
+
var EMBED_FOLDER_PERMISSIONS_NOTE = "Folder-permission attributes could not be resolved before the URL was signed; the embedded dashboard's folder visibility may differ from the Insights app until the next request.";
|
|
1037
|
+
var EMBED_TEMPLATE_NOTE = "This embeds the built-in template.";
|
|
1038
|
+
var EMBED_SAVED_NOTE = "This embeds a saved dashboard, which needs the tenant's Insights licence in full mode.";
|
|
1039
|
+
var EMBED_LOCALE_NOTE = "Insights maps the locale to a Looker locale and uses English for any value outside its list (en, ja, zh-cn, zh-tw, es, es-mx, tr, ko, pt, pt-br, de, fr, ru at the source read), so an unlisted value is not an error.";
|
|
1040
|
+
var ROW_FLAGS = [
|
|
1041
|
+
"hasRoiExplore",
|
|
1042
|
+
"hasIntegrationModel",
|
|
1043
|
+
"hasOrgScope",
|
|
1044
|
+
"hasUserAttrOrCustomFields"
|
|
1045
|
+
];
|
|
1046
|
+
var FOLDER_ORDER = {
|
|
1047
|
+
personal: 0,
|
|
1048
|
+
tenant: 1,
|
|
1049
|
+
templates: 2,
|
|
1050
|
+
organization: 3
|
|
1051
|
+
};
|
|
1052
|
+
function projectRow(listed) {
|
|
1053
|
+
const row = {
|
|
1054
|
+
id: listed.id,
|
|
1055
|
+
title: listed.title,
|
|
1056
|
+
folder: listed.folder,
|
|
1057
|
+
ownerName: pickScalar(listed.record.ownerName),
|
|
1058
|
+
hasRoiExplore: false,
|
|
1059
|
+
hasIntegrationModel: false,
|
|
1060
|
+
hasOrgScope: false,
|
|
1061
|
+
hasUserAttrOrCustomFields: false
|
|
1062
|
+
};
|
|
1063
|
+
for (const flag of ROW_FLAGS) {
|
|
1064
|
+
const value = listed.record[flag];
|
|
1065
|
+
if (typeof value !== "boolean") {
|
|
1066
|
+
throw new LookerContractError(`Insights returned a Looker dashboard ${listed.folder} row whose ${flag} is not a boolean`);
|
|
1067
|
+
}
|
|
1068
|
+
row[flag] = value;
|
|
1069
|
+
}
|
|
1070
|
+
return row;
|
|
1071
|
+
}
|
|
1072
|
+
function projectLookerListing(response) {
|
|
1073
|
+
const listing = readLookerListing(response);
|
|
1074
|
+
return {
|
|
1075
|
+
rows: listing.rows.map(projectRow),
|
|
1076
|
+
omittedFolders: listing.omittedFolders
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
function compareLookerRows(a, b) {
|
|
1080
|
+
const byFolder = FOLDER_ORDER[a.folder] - FOLDER_ORDER[b.folder];
|
|
1081
|
+
if (byFolder !== 0) {
|
|
1082
|
+
return byFolder;
|
|
1083
|
+
}
|
|
1084
|
+
const byTitle = compareRowKeys(a.title ?? "", b.title ?? "");
|
|
1085
|
+
if (byTitle !== 0) {
|
|
1086
|
+
return byTitle;
|
|
1087
|
+
}
|
|
1088
|
+
return compareRowKeys(a.id, b.id);
|
|
1089
|
+
}
|
|
1090
|
+
function visibleOmittedFolders(listing, folder) {
|
|
1091
|
+
if (folder === undefined) {
|
|
1092
|
+
return listing.omittedFolders;
|
|
1093
|
+
}
|
|
1094
|
+
return listing.omittedFolders.filter((omitted) => omitted === folder);
|
|
1095
|
+
}
|
|
1096
|
+
function omissionNotes(omitted) {
|
|
1097
|
+
return joinParts([
|
|
1098
|
+
omitted.includes("personal") ? PERSONAL_OMITTED_NOTE : "",
|
|
1099
|
+
omittedFoldersNote(omitted.filter((folder) => folder !== "personal"))
|
|
1100
|
+
]);
|
|
1101
|
+
}
|
|
1102
|
+
function rowNotes(returned) {
|
|
1103
|
+
if (returned === 0) {
|
|
1104
|
+
return "";
|
|
1105
|
+
}
|
|
1106
|
+
return joinParts([LOOKER_ID_SPACE_NOTE, LIST_CACHE_NOTE]);
|
|
1107
|
+
}
|
|
1108
|
+
function buildListInstructions2(omitted, total, returned, offset, hasMore) {
|
|
1109
|
+
return joinParts([
|
|
1110
|
+
rowNotes(returned),
|
|
1111
|
+
omissionNotes(omitted),
|
|
1112
|
+
offset > 0 ? LIST_PAGING_COST_NOTE : "",
|
|
1113
|
+
total === 0 ? EMPTY_LIST_NOTE : "",
|
|
1114
|
+
total > 0 && returned === 0 ? overPagedNote(total) : "",
|
|
1115
|
+
hasMore ? truncatedNote("a Looker dashboard") : ""
|
|
1116
|
+
]);
|
|
1117
|
+
}
|
|
1118
|
+
function lookerListSpec(options) {
|
|
1119
|
+
const folder = options.lookerFolder;
|
|
1120
|
+
let listing = { rows: [], omittedFolders: [] };
|
|
1121
|
+
return {
|
|
1122
|
+
code: "InsightsLookerDashboardsList",
|
|
1123
|
+
family: LOOKER_FAMILY,
|
|
1124
|
+
project: (response) => {
|
|
1125
|
+
listing = projectLookerListing(response);
|
|
1126
|
+
return listing.rows;
|
|
1127
|
+
},
|
|
1128
|
+
finalize: (rows) => {
|
|
1129
|
+
const sorted = [...rows].sort(compareLookerRows);
|
|
1130
|
+
return folder === undefined ? sorted : sorted.filter((row) => row.folder === folder);
|
|
1131
|
+
},
|
|
1132
|
+
instructions: (rows, page, hasMore) => buildListInstructions2(visibleOmittedFolders(listing, folder), rows.length, page.length, options.offset ?? 0, hasMore),
|
|
1133
|
+
onHttpError: claimLookerError(LIST_WRITERS)
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
var LOOKER_USER_UNAVAILABLE_FAILURE = {
|
|
1137
|
+
errorCode: "server_error",
|
|
1138
|
+
retry: "RetryLater",
|
|
1139
|
+
message: "Insights could not read or provision the caller's Looker user.",
|
|
1140
|
+
instructions: RETRY_LATER_INSTRUCTIONS
|
|
1141
|
+
};
|
|
1142
|
+
var LOOKER_UNAVAILABLE_FAILURE = {
|
|
1143
|
+
errorCode: "server_error",
|
|
1144
|
+
retry: "RetryLater",
|
|
1145
|
+
message: "Looker is unavailable to Insights right now.",
|
|
1146
|
+
instructions: `The Insights service reached Looker and Looker did not answer. ${RETRY_LATER_INSTRUCTIONS}`
|
|
1147
|
+
};
|
|
1148
|
+
var LIST_FORBIDDEN_FAILURE = {
|
|
1149
|
+
errorCode: "permission_denied",
|
|
1150
|
+
retry: "RetryWillNotFix",
|
|
1151
|
+
message: "The session cannot list Looker dashboards in the current tenant.",
|
|
1152
|
+
instructions: "The Insights Dashboard View permission is required. Do not retry; ask a tenant administrator for the role."
|
|
1153
|
+
};
|
|
1154
|
+
var TITLE_LOOKUP_NOTE = "This failure came from the title lookup, which lists the dashboards. Insights' no-dashboards check does not count organization dashboards, so an organization dashboard can still embed when passed by its id, which skips the lookup; 'list' fails the same way, so take the id from the Insights app.";
|
|
1155
|
+
function writeFailure(failure) {
|
|
1156
|
+
return (error) => writeInsightsFailure(failure, error);
|
|
1157
|
+
}
|
|
1158
|
+
function listWriters(noDashboardsNote) {
|
|
1159
|
+
return {
|
|
1160
|
+
[`403:${PORTAL_ERROR_CODE.PermissionsUserUnauthorized}`]: writeFailure(LIST_FORBIDDEN_FAILURE),
|
|
1161
|
+
[`500:${PORTAL_ERROR_CODE.UnableToRetrieveDashboards}`]: (error) => writeInsightsFailure(listRetrieveFailure(error, noDashboardsNote), error),
|
|
1162
|
+
[`503:${PORTAL_ERROR_CODE.LookerUnavailableError}`]: writeFailure(LOOKER_UNAVAILABLE_FAILURE)
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
var LIST_WRITERS = listWriters("");
|
|
1166
|
+
var TITLE_LOOKUP_WRITERS = listWriters(TITLE_LOOKUP_NOTE);
|
|
1167
|
+
function listRetrieveFailure(error, noDashboardsNote) {
|
|
1168
|
+
const detail = error.bodyHint?.portalErrorMessage;
|
|
1169
|
+
if (detail === LOOKER_NO_DASHBOARDS_MESSAGE) {
|
|
1170
|
+
return {
|
|
1171
|
+
errorCode: "server_error",
|
|
1172
|
+
retry: "RetryWillNotFix",
|
|
1173
|
+
message: "This session sees no personal, tenant or template Looker dashboards, and this deployment reports that as an error.",
|
|
1174
|
+
instructions: joinParts([
|
|
1175
|
+
`Insights lists the personal folder ${PERSONAL_FOLDER_AUDIENCE} and hides ROI templates from a session without Insights ROI View, so a role can change this answer as well as the tenant's content. Create a dashboard in the Insights app, ask for the tenant's template models to be provisioned, or ask a tenant administrator for those roles. Do not retry; the same request answers the same way until one of those changes.`,
|
|
1176
|
+
noDashboardsNote
|
|
1177
|
+
])
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
if (detail === LOOKER_USER_UNAVAILABLE_MESSAGE) {
|
|
1181
|
+
return LOOKER_USER_UNAVAILABLE_FAILURE;
|
|
1182
|
+
}
|
|
1183
|
+
return {
|
|
1184
|
+
errorCode: "server_error",
|
|
1185
|
+
retry: "RetryLater",
|
|
1186
|
+
message: "Insights could not retrieve the Looker dashboards.",
|
|
1187
|
+
instructions: "Either the Looker user could not be read, which is transient, or this session sees no personal, tenant or template dashboards and this deployment reports that as an error, which a retry will not clear. The response named neither, so this reports the retryable one; if the same request answers this way twice, check whether this session can see any dashboards in the Insights app before retrying again."
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
async function executeLookerDashboardsList(options) {
|
|
1191
|
+
await executeInsightsList(options, listLookerDashboards, lookerListSpec(options));
|
|
1192
|
+
}
|
|
1193
|
+
var EMBED_NOT_FOUND_FAILURE = {
|
|
1194
|
+
errorCode: "not_found",
|
|
1195
|
+
retry: "RetryWillNotFix",
|
|
1196
|
+
message: "The Looker dashboard passed as <dashboard> is not one this session can embed.",
|
|
1197
|
+
instructions: `It is not among the dashboards this session can reach: another user's personal dashboard, and a dashboard deleted within the last hour that 'list' still shows from its cache, answer the same way. A numeric id also answers this way when the tenant's Insights licence is not in full mode, which limits embedding to template dashboards. Insights also answers this way when its own permission check fails for a transient reason, so an id 'list' showed a moment ago may still embed on one more request; if it answers this way twice, treat it as unreachable. A value that is all digits or contains '::' is treated as an id, so a dashboard whose title looks like one is reachable only by its id. Run ${LIST_COMMAND} for the titles and ids this session can see.`
|
|
1198
|
+
};
|
|
1199
|
+
var EMBED_WRITERS = {
|
|
1200
|
+
[`401:${PORTAL_ERROR_CODE.PermissionsUserUnauthorized}`]: writeFailure(EMBED_NOT_FOUND_FAILURE),
|
|
1201
|
+
[`403:${PORTAL_ERROR_CODE.PermissionsUserUnauthorized}`]: writeFailure({
|
|
1202
|
+
errorCode: "permission_denied",
|
|
1203
|
+
retry: "RetryWillNotFix",
|
|
1204
|
+
message: "The session cannot embed the Looker dashboard passed as <dashboard>.",
|
|
1205
|
+
instructions: "Embedding needs the Insights Dashboard View or Edit permission in the active tenant, and an organization-scoped dashboard also needs organization administrator or organization viewer. Do not retry until the role changes."
|
|
1206
|
+
}),
|
|
1207
|
+
[`400:${PORTAL_ERROR_CODE.InvalidUserInput}`]: writeFailure({
|
|
1208
|
+
errorCode: "invalid_argument",
|
|
1209
|
+
retry: "RetryWillNotFix",
|
|
1210
|
+
message: "Insights rejected the Looker dashboard embed request.",
|
|
1211
|
+
instructions: "The request body did not bind, or it named a filter only the service-to-service embed path accepts. Report it to the Insights owner; the CLI sends no such field."
|
|
1212
|
+
}),
|
|
1213
|
+
[`500:${PORTAL_ERROR_CODE.UnableToRetrieveDashboards}`]: writeFailure(LOOKER_USER_UNAVAILABLE_FAILURE),
|
|
1214
|
+
[`500:${PORTAL_ERROR_CODE.UnableToGetEmbedLink}`]: writeFailure({
|
|
1215
|
+
errorCode: "server_error",
|
|
1216
|
+
retry: "RetryLater",
|
|
1217
|
+
message: "Insights could not mint the Looker dashboard embed URL.",
|
|
1218
|
+
instructions: `The tenant timezone lookup, the dashboard metadata read, or Looker's own SSO call failed. ${RETRY_LATER_INSTRUCTIONS}`
|
|
1219
|
+
}),
|
|
1220
|
+
[`503:${PORTAL_ERROR_CODE.LookerUnavailableError}`]: writeFailure(LOOKER_UNAVAILABLE_FAILURE)
|
|
1221
|
+
};
|
|
1222
|
+
function writeResolveFailure(error) {
|
|
1223
|
+
if (error.kind === "ambiguous") {
|
|
1224
|
+
const candidates = error.candidates.map((candidate) => `${candidate.id} (${candidate.folder})`).join(", ");
|
|
1225
|
+
writeInsightsFailure({
|
|
1226
|
+
errorCode: "invalid_argument",
|
|
1227
|
+
retry: "RetryWillNotFix",
|
|
1228
|
+
message: error.message,
|
|
1229
|
+
instructions: `Pass one of these ids instead of the title: ${candidates}. Run ${LIST_COMMAND} to see which is which.`
|
|
1230
|
+
});
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
writeInsightsFailure({
|
|
1234
|
+
errorCode: "not_found",
|
|
1235
|
+
retry: "RetryWillNotFix",
|
|
1236
|
+
message: error.message,
|
|
1237
|
+
instructions: `Run ${LIST_COMMAND} to see the titles and ids this session can see. The title is matched exactly, including case, after trimming spaces at either end. The personal folder is listed ${PERSONAL_FOLDER_AUDIENCE}, so a dashboard in another user's personal folder is never listed. Pass the id instead of the title to skip the lookup.`
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
function buildEmbedInstructions(ref, result, localization) {
|
|
1241
|
+
return joinParts([
|
|
1242
|
+
EMBED_CREDENTIAL_NOTE,
|
|
1243
|
+
EMBED_SESSION_NOTE,
|
|
1244
|
+
result.folderPermissionsSuccess ? "" : EMBED_FOLDER_PERMISSIONS_NOTE,
|
|
1245
|
+
isLookerTemplateDashboardId(ref.id) ? EMBED_TEMPLATE_NOTE : EMBED_SAVED_NOTE,
|
|
1246
|
+
localization === undefined ? "" : EMBED_LOCALE_NOTE
|
|
1247
|
+
]);
|
|
1248
|
+
}
|
|
1249
|
+
async function executeLookerEmbedUrl(dashboard, theme, localization) {
|
|
1250
|
+
const config = await resolveInsightsConfig();
|
|
1251
|
+
if (config === null) {
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
const ref = await resolveOrWrite(config, dashboard);
|
|
1255
|
+
if (ref === undefined) {
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
const [requestError, raw] = await catchError(getLookerDashboardEmbedUrl(config, {
|
|
1259
|
+
dashboardId: ref.value.id,
|
|
1260
|
+
theme,
|
|
1261
|
+
localization
|
|
1262
|
+
}));
|
|
1263
|
+
if (requestError) {
|
|
1264
|
+
if (!claimHttpError(requestError, claimLookerError(EMBED_WRITERS))) {
|
|
1265
|
+
writeInsightsError(requestError, LOOKER_FAMILY);
|
|
1266
|
+
}
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
const [guardError, result] = catchError(() => requireEmbedResult(parseLookerEnvelope(raw, "lookerDashboardEmbedUrl")));
|
|
1270
|
+
if (guardError) {
|
|
1271
|
+
writeInsightsError(guardError, LOOKER_FAMILY);
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
OutputFormatter.success({
|
|
1275
|
+
Result: RESULTS.Success,
|
|
1276
|
+
Code: "InsightsLookerDashboardEmbedUrl",
|
|
1277
|
+
Data: {
|
|
1278
|
+
dashboardId: ref.value.id,
|
|
1279
|
+
resolvedFrom: ref.value.resolvedFrom,
|
|
1280
|
+
url: result.url,
|
|
1281
|
+
theme,
|
|
1282
|
+
localization: localization ?? null,
|
|
1283
|
+
folderPermissionsSuccess: result.folderPermissionsSuccess
|
|
1284
|
+
},
|
|
1285
|
+
Instructions: buildEmbedInstructions(ref.value, result, localization)
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
async function resolveOrWrite(config, dashboard) {
|
|
1289
|
+
const [error, value] = await catchError(resolveLookerDashboard(config, dashboard));
|
|
1290
|
+
if (error) {
|
|
1291
|
+
if (error instanceof LookerResolveError) {
|
|
1292
|
+
writeResolveFailure(error);
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1295
|
+
if (!claimHttpError(error, claimLookerError(TITLE_LOOKUP_WRITERS))) {
|
|
1296
|
+
writeInsightsError(error, LOOKER_FAMILY);
|
|
1297
|
+
}
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
return { value };
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
// src/commands/looker-dashboards.ts
|
|
1304
|
+
var LOOKER_DASHBOARDS_GROUP = "looker-dashboards";
|
|
1305
|
+
function registerLookerDashboardsCommand(program) {
|
|
1306
|
+
const lookerCmd = program.command(LOOKER_DASHBOARDS_GROUP).description("Read the Looker-era Insights dashboards and mint an embed URL for one");
|
|
1307
|
+
addListPaginationOptions(lookerCmd.command("list").description("List the Looker-era dashboards this session can see, across its personal, tenant, template and organization folders")).addOption(new Option("--looker-folder <folder>", "Show only one Looker folder").choices([...LOOKER_FOLDERS])).trackedAction(processContext, async (options) => {
|
|
1308
|
+
await executeLookerDashboardsList(options);
|
|
1309
|
+
});
|
|
1310
|
+
lookerCmd.command("get-embed-url").description("Mint a signed, single-user Looker embed URL for one dashboard, by title or by id").argument("<dashboard>", "Dashboard title, or its id from 'looker-dashboards list'").addOption(new Option("--theme <theme>", "Theme the embedded dashboard renders with").choices([...LOOKER_THEMES]).default("light")).option("--localization <locale>", "Locale for the embedded dashboard; Insights falls back to English for a locale it does not know").trackedAction(processContext, async (dashboard, options) => {
|
|
1311
|
+
if (dashboard.trim() === "") {
|
|
1312
|
+
failValidation("<dashboard> must not be empty.", "Pass a dashboard title, or an id from 'uip insights looker-dashboards list'.");
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
const localization = trimOption("--localization", options.localization, "Pass a locale such as 'ja', or drop the flag to use the backend default.");
|
|
1316
|
+
if (localization === undefined) {
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
await executeLookerEmbedUrl(dashboard.trim(), options.theme, localization.value);
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
|
|
940
1323
|
// src/utils/machine-projections.ts
|
|
941
1324
|
class MachineContractError extends Error {
|
|
942
1325
|
constructor(message) {
|
|
@@ -2264,9 +2647,10 @@ var registerCommands = async (program) => {
|
|
|
2264
2647
|
registerDashboardFiltersCommand(program);
|
|
2265
2648
|
registerQueuesCommand(program);
|
|
2266
2649
|
registerMachinesCommand(program);
|
|
2650
|
+
registerLookerDashboardsCommand(program);
|
|
2267
2651
|
registerExportConfigurationsCommand(program);
|
|
2268
2652
|
};
|
|
2269
2653
|
|
|
2270
2654
|
export { metadata, registerCommands };
|
|
2271
2655
|
|
|
2272
|
-
//# debugId=
|
|
2656
|
+
//# debugId=8C3E95E68E80756964756E2164756E21
|