@uipath/automation-hub-tool 1.201.0-preview.132 → 1.201.0
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 +1 -1
- package/dist/{tool-8a7khjqa.js → tool-gfe5ee7p.js} +102 -24
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2112,7 +2112,7 @@ var require_commander = __commonJS((exports) => {
|
|
|
2112
2112
|
var package_default = {
|
|
2113
2113
|
name: "@uipath/automation-hub-tool",
|
|
2114
2114
|
license: "MIT",
|
|
2115
|
-
version: "1.201.0
|
|
2115
|
+
version: "1.201.0",
|
|
2116
2116
|
description: "Automation Hub — automation ideas, pipeline, taxonomy and users.",
|
|
2117
2117
|
private: false,
|
|
2118
2118
|
repository: {
|
|
@@ -3347,6 +3347,12 @@ var slot = singleton("ProxyAuthHttpsAgent");
|
|
|
3347
3347
|
// ../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
3348
3348
|
var providerSlot = singleton("TelemetryProvider");
|
|
3349
3349
|
|
|
3350
|
+
// ../common/src/telemetry/telemetry-config.ts
|
|
3351
|
+
function isTelemetryDisabled() {
|
|
3352
|
+
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
3353
|
+
return value === "1" || value === "true";
|
|
3354
|
+
}
|
|
3355
|
+
|
|
3350
3356
|
// ../common/src/telemetry/telemetry-spool.ts
|
|
3351
3357
|
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
3352
3358
|
var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
@@ -4386,6 +4392,9 @@ var ScreenLogger;
|
|
|
4386
4392
|
})(ScreenLogger ||= {});
|
|
4387
4393
|
// ../common/src/sdk-user-agent.ts
|
|
4388
4394
|
var USER_AGENT_HEADER = "User-Agent";
|
|
4395
|
+
var CODING_AGENT_HEADER = "x-coding-agent-info";
|
|
4396
|
+
var AGENT_PROPERTY = "agent";
|
|
4397
|
+
var CODING_AGENT_PROPERTY = "CodingAgent";
|
|
4389
4398
|
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
4390
4399
|
function splitUserAgentTokens(value) {
|
|
4391
4400
|
return value?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
@@ -4407,6 +4416,13 @@ function getEffectiveUserAgent(userAgent) {
|
|
|
4407
4416
|
function getHeaderName(headers, headerName) {
|
|
4408
4417
|
return Object.keys(headers).find((key) => key.toLowerCase() === headerName.toLowerCase());
|
|
4409
4418
|
}
|
|
4419
|
+
function getSdkAgentInfo() {
|
|
4420
|
+
if (isTelemetryDisabled()) {
|
|
4421
|
+
return;
|
|
4422
|
+
}
|
|
4423
|
+
const agent = getGlobalTelemetryProperties()?.[AGENT_PROPERTY];
|
|
4424
|
+
return agent === undefined ? undefined : String(agent);
|
|
4425
|
+
}
|
|
4410
4426
|
function getSdkUserAgentToken(pkg) {
|
|
4411
4427
|
const packageName = pkg.name.replace(/^@uipath\//, "");
|
|
4412
4428
|
return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
|
|
@@ -4417,6 +4433,17 @@ function addSdkUserAgentHeader(headers, userAgent) {
|
|
|
4417
4433
|
result[headerName ?? USER_AGENT_HEADER] = appendUserAgentToken(headerName ? result[headerName] : undefined, getEffectiveUserAgent(userAgent));
|
|
4418
4434
|
return result;
|
|
4419
4435
|
}
|
|
4436
|
+
function addSdkCodingAgentHeader(headers, agent = getSdkAgentInfo()) {
|
|
4437
|
+
const result = { ...headers ?? {} };
|
|
4438
|
+
if (agent === undefined) {
|
|
4439
|
+
return result;
|
|
4440
|
+
}
|
|
4441
|
+
const headerName = getHeaderName(result, CODING_AGENT_HEADER);
|
|
4442
|
+
result[headerName ?? CODING_AGENT_HEADER] = JSON.stringify({
|
|
4443
|
+
[CODING_AGENT_PROPERTY]: agent
|
|
4444
|
+
});
|
|
4445
|
+
return result;
|
|
4446
|
+
}
|
|
4420
4447
|
// ../common/src/telemetry/ship-succeeded.ts
|
|
4421
4448
|
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
4422
4449
|
// ../common/src/tool-provider.ts
|
|
@@ -5705,6 +5732,9 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
5705
5732
|
]);
|
|
5706
5733
|
// src/client.ts
|
|
5707
5734
|
var SDK_USER_AGENT = getSdkUserAgentToken(package_default);
|
|
5735
|
+
function authSourceUserAgentToken() {
|
|
5736
|
+
return isEnvAuthEnabled() ? "auth-source/env" : "auth-source/login";
|
|
5737
|
+
}
|
|
5708
5738
|
var AH_API_BASE = "api/v1/openapi";
|
|
5709
5739
|
async function createAhConfig(tenantOverride) {
|
|
5710
5740
|
const ctx = await getAuthContext({
|
|
@@ -5783,11 +5813,11 @@ function parseJsonBody(text) {
|
|
|
5783
5813
|
return parsed;
|
|
5784
5814
|
}
|
|
5785
5815
|
function buildHeaders(config) {
|
|
5786
|
-
return addSdkUserAgentHeader({
|
|
5816
|
+
return addSdkCodingAgentHeader(addSdkUserAgentHeader({
|
|
5787
5817
|
Authorization: `Bearer ${config.authToken}`,
|
|
5788
5818
|
"Content-Type": "application/json",
|
|
5789
5819
|
Accept: "application/json"
|
|
5790
|
-
}, SDK_USER_AGENT);
|
|
5820
|
+
}, `${SDK_USER_AGENT} ${authSourceUserAgentToken()}`));
|
|
5791
5821
|
}
|
|
5792
5822
|
async function ahRequest(config, method, path, body) {
|
|
5793
5823
|
const response = await fetch(buildAhUrl(config, path), {
|
|
@@ -6083,21 +6113,40 @@ async function writeBytes(path, bytes) {
|
|
|
6083
6113
|
async function writeText(path, text) {
|
|
6084
6114
|
await getFileSystem().writeFile(path, text);
|
|
6085
6115
|
}
|
|
6086
|
-
var
|
|
6116
|
+
var MEDIA_MIMETYPES = {
|
|
6087
6117
|
jpg: "image/jpeg",
|
|
6088
6118
|
jpeg: "image/jpeg",
|
|
6089
6119
|
png: "image/png",
|
|
6090
6120
|
gif: "image/gif",
|
|
6091
6121
|
mp4: "video/mp4"
|
|
6092
6122
|
};
|
|
6123
|
+
var DOCUMENT_MIMETYPES = {
|
|
6124
|
+
...MEDIA_MIMETYPES,
|
|
6125
|
+
pdf: "application/pdf",
|
|
6126
|
+
md: "text/markdown",
|
|
6127
|
+
txt: "text/plain",
|
|
6128
|
+
csv: "text/csv",
|
|
6129
|
+
json: "application/json",
|
|
6130
|
+
zip: "application/zip",
|
|
6131
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
6132
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
6133
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
6134
|
+
doc: "application/msword"
|
|
6135
|
+
};
|
|
6093
6136
|
var MAX_UPLOAD_BYTES = 200 * 1024 * 1024;
|
|
6094
|
-
async function readUpload(path) {
|
|
6137
|
+
async function readUpload(path, allowed) {
|
|
6095
6138
|
const fs = getFileSystem();
|
|
6096
6139
|
const name = fs.path.basename(path);
|
|
6097
6140
|
const ext = name.includes(".") ? (name.split(".").pop() ?? "").toLowerCase() : "";
|
|
6098
|
-
|
|
6099
|
-
if (
|
|
6100
|
-
|
|
6141
|
+
let mimetype;
|
|
6142
|
+
if (allowed !== undefined) {
|
|
6143
|
+
const found = allowed[ext];
|
|
6144
|
+
if (found === undefined) {
|
|
6145
|
+
throw new Error(`Unsupported media type '.${ext}' — the endpoint accepts ` + `${Object.keys(allowed).join(", ")}.`);
|
|
6146
|
+
}
|
|
6147
|
+
mimetype = found;
|
|
6148
|
+
} else {
|
|
6149
|
+
mimetype = DOCUMENT_MIMETYPES[ext] ?? "application/octet-stream";
|
|
6101
6150
|
}
|
|
6102
6151
|
const bytes = await fs.readFile(path);
|
|
6103
6152
|
if (bytes === null)
|
|
@@ -6536,9 +6585,17 @@ async function emitSchema(body, automationId, options) {
|
|
|
6536
6585
|
});
|
|
6537
6586
|
}
|
|
6538
6587
|
function registerCreate(parent) {
|
|
6539
|
-
parent.command("create").description("Submit a new automation idea. --source-type picks the submission " + "form; --from-schema submits a filled 'schema get' document instead.").addOption(new Option("--source-type <type>", "Idea source type (required)").choices(SOURCE_TYPES)).requiredOption("--file <json-file>", "JSON request body, or the filled user_inputs document with --from-schema").option("--from-schema", "Submit through the schema endpoint using the document from 'automations schema get'").examples(CREATE_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
6540
|
-
if (options.
|
|
6541
|
-
failValidation("--
|
|
6588
|
+
parent.command("create").description("Submit a new automation idea. --source-type picks the submission " + "form; --from-schema submits a filled 'schema get' document instead.").addOption(new Option("--source-type <type>", "Idea source type (required)").choices(SOURCE_TYPES)).requiredOption("--file <json-file>", "JSON request body, or the filled user_inputs document with --from-schema").option("--from-schema", "Submit through the schema endpoint using the document from 'automations schema get'").addOption(new Option("--idea-flow-id <id>", "Target idea flow for --from-schema (from 'uip ah idea-flows list') — " + "replaces --source-type for tenants with customized flows").conflicts("sourceType")).examples(CREATE_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
6589
|
+
if (options.ideaFlowId !== undefined && options.fromSchema !== true) {
|
|
6590
|
+
failValidation("--idea-flow-id requires --from-schema.", "The fixed-shape submission endpoints do not take an idea flow.");
|
|
6591
|
+
return;
|
|
6592
|
+
}
|
|
6593
|
+
if (options.ideaFlowId !== undefined && (!/^\d+$/.test(options.ideaFlowId) || !Number.isSafeInteger(Number(options.ideaFlowId)))) {
|
|
6594
|
+
failValidation("--idea-flow-id must be a whole number.", "Find flow ids with 'uip ah idea-flows list'.");
|
|
6595
|
+
return;
|
|
6596
|
+
}
|
|
6597
|
+
if (options.sourceType === undefined && options.ideaFlowId === undefined) {
|
|
6598
|
+
failValidation("--source-type is required.", `Pass one of: ${SOURCE_TYPES.join(", ")} — or, with ` + "--from-schema, target a flow directly via --idea-flow-id.");
|
|
6542
6599
|
return;
|
|
6543
6600
|
}
|
|
6544
6601
|
const config = await loadConfigOrExit();
|
|
@@ -6550,7 +6607,7 @@ function registerCreate(parent) {
|
|
|
6550
6607
|
const submit = resolveSubmit(options, payload);
|
|
6551
6608
|
const [err, body] = await catchError2(ahPost(config, submit.path, submit.body));
|
|
6552
6609
|
if (err) {
|
|
6553
|
-
failFromApi(err, `The request body must match the ${submit.path} schema. ` + "Get the expected shape with 'uip ah automations schema get
|
|
6610
|
+
failFromApi(err, `The request body must match the ${submit.path} schema. ` + "Get the expected shape with 'uip ah automations schema get " + (options.ideaFlowId !== undefined ? `--idea-flow-id ${options.ideaFlowId}'.` : `--source-type ${options.sourceType}'.`));
|
|
6554
6611
|
return;
|
|
6555
6612
|
}
|
|
6556
6613
|
const data = unwrapData(body) ?? {};
|
|
@@ -6562,14 +6619,14 @@ function registerCreate(parent) {
|
|
|
6562
6619
|
});
|
|
6563
6620
|
}
|
|
6564
6621
|
function resolveSubmit(options, payload) {
|
|
6565
|
-
const fixed = SUBMIT_PATHS[options.sourceType];
|
|
6622
|
+
const fixed = options.sourceType !== undefined ? SUBMIT_PATHS[options.sourceType] : undefined;
|
|
6566
6623
|
if (fixed !== undefined && options.fromSchema !== true) {
|
|
6567
6624
|
return { path: fixed, body: payload };
|
|
6568
6625
|
}
|
|
6569
6626
|
return {
|
|
6570
6627
|
path: "/idea-from-schema",
|
|
6571
6628
|
body: {
|
|
6572
|
-
source_type: options.sourceType,
|
|
6629
|
+
...options.ideaFlowId !== undefined ? { idea_flow_id: Number(options.ideaFlowId) } : { source_type: options.sourceType },
|
|
6573
6630
|
user_inputs: userInputsOf(payload)
|
|
6574
6631
|
}
|
|
6575
6632
|
};
|
|
@@ -6926,11 +6983,19 @@ var LIST_EXAMPLES4 = [
|
|
|
6926
6983
|
];
|
|
6927
6984
|
var CREATE_EXAMPLES3 = [
|
|
6928
6985
|
{
|
|
6929
|
-
Description: "
|
|
6930
|
-
Command: 'uip ah documents create 20 --
|
|
6986
|
+
Description: "Upload a document file to an automation",
|
|
6987
|
+
Command: 'uip ah documents create 20 --title "Process definition" ' + '--description "PDD v2" --document-type-id 1 --file ./pdd.docx',
|
|
6931
6988
|
Output: {
|
|
6932
6989
|
Code: "AhDocumentsCreate",
|
|
6933
|
-
Data: { AutomationId: 20, Title: "Process definition" }
|
|
6990
|
+
Data: { AutomationId: 20, Id: 11, Title: "Process definition" }
|
|
6991
|
+
}
|
|
6992
|
+
},
|
|
6993
|
+
{
|
|
6994
|
+
Description: "Attach a document by link instead of uploading bytes",
|
|
6995
|
+
Command: 'uip ah documents create 20 --title "Process definition" ' + '--description "PDD v2" --document-type-id 1 --embed-link https://acme.sharepoint.com/pdd.docx',
|
|
6996
|
+
Output: {
|
|
6997
|
+
Code: "AhDocumentsCreate",
|
|
6998
|
+
Data: { AutomationId: 20, Id: 11, Title: "Process definition" }
|
|
6934
6999
|
}
|
|
6935
7000
|
}
|
|
6936
7001
|
];
|
|
@@ -6952,19 +7017,32 @@ function registerDocumentsCommand(program2) {
|
|
|
6952
7017
|
return;
|
|
6953
7018
|
await runPagedList(config, (page) => `/automations/${encodeURIComponent(automationId)}/documents${query({ page })}`, "documents", "AhDocumentsList", DOCUMENT_FIELDS, options, "Check the automation id ('uip ah automations list').");
|
|
6954
7019
|
});
|
|
6955
|
-
documentsCmd.command("create <automation-id>").description("Attach a document to an automation
|
|
7020
|
+
documentsCmd.command("create <automation-id>").description("Attach a document to an automation — upload the file's bytes with " + "--file, or link to it with --embed-link (exactly one of the two).").option("--submitter <email>", "Email of the submitting Automation Hub user (defaults to the caller)").requiredOption("--title <text>", "Document title").requiredOption("--description <text>", "Document description").requiredOption("--document-type-id <id>", "Document type id").option("--file <path>", "Local document file to upload").option("--embed-link <url>", "Link to an already-hosted document").examples(CREATE_EXAMPLES3).trackedAction(processContext, async (automationId, options) => {
|
|
7021
|
+
if (options.file === undefined === (options.embedLink === undefined)) {
|
|
7022
|
+
failValidation("Pass exactly one of --file or --embed-link.", "--file uploads the document's bytes; --embed-link records a URL.");
|
|
7023
|
+
return;
|
|
7024
|
+
}
|
|
6956
7025
|
const config = await loadConfigOrExit();
|
|
6957
7026
|
if (!config)
|
|
6958
7027
|
return;
|
|
7028
|
+
let upload;
|
|
7029
|
+
if (options.file !== undefined) {
|
|
7030
|
+
const [readErr, read] = await catchError2(readUpload(options.file, undefined));
|
|
7031
|
+
if (readErr) {
|
|
7032
|
+
failValidation(readErr.message, "Check the --file path and size.");
|
|
7033
|
+
return;
|
|
7034
|
+
}
|
|
7035
|
+
upload = read;
|
|
7036
|
+
}
|
|
6959
7037
|
const [err, body] = await catchError2(ahPost(config, `/automations/${encodeURIComponent(automationId)}/documents`, {
|
|
6960
|
-
submitter: options.submitter,
|
|
7038
|
+
...options.submitter === undefined ? {} : { submitter: options.submitter },
|
|
6961
7039
|
document_title: options.title,
|
|
6962
7040
|
document_description: options.description,
|
|
6963
7041
|
document_type_id: Number(options.documentTypeId),
|
|
6964
|
-
embed_link: options.embedLink
|
|
7042
|
+
...upload !== undefined ? { file: upload } : { embed_link: options.embedLink }
|
|
6965
7043
|
}));
|
|
6966
7044
|
if (err) {
|
|
6967
|
-
failFromApi(err, "Check the automation id
|
|
7045
|
+
failFromApi(err, "Check the automation id and that --document-type-id is valid; " + "if given, --submitter must be an Automation Hub user " + "('uip ah users list').");
|
|
6968
7046
|
return;
|
|
6969
7047
|
}
|
|
6970
7048
|
const data = unwrapData(body) ?? {};
|
|
@@ -6972,7 +7050,7 @@ function registerDocumentsCommand(program2) {
|
|
|
6972
7050
|
AutomationId: Number(automationId),
|
|
6973
7051
|
Id: data.document_id,
|
|
6974
7052
|
Title: options.title,
|
|
6975
|
-
EmbedLink: options.embedLink
|
|
7053
|
+
...options.embedLink === undefined ? { FileId: data.file_id, File: upload?.file_name } : { EmbedLink: options.embedLink }
|
|
6976
7054
|
});
|
|
6977
7055
|
});
|
|
6978
7056
|
documentsCmd.command("download <file-id>").description("Download a stored document by its file id").requiredOption("--destination <path>", "Local path to write the file to").examples(DOWNLOAD_EXAMPLES2).trackedAction(processContext, async (fileId, options) => {
|
|
@@ -7068,7 +7146,7 @@ function registerMediaCommand(program2) {
|
|
|
7068
7146
|
const config = await loadConfigOrExit();
|
|
7069
7147
|
if (!config)
|
|
7070
7148
|
return;
|
|
7071
|
-
const [readErr, upload] = await catchError2(readUpload(options.file));
|
|
7149
|
+
const [readErr, upload] = await catchError2(readUpload(options.file, MEDIA_MIMETYPES));
|
|
7072
7150
|
if (readErr) {
|
|
7073
7151
|
failValidation(readErr.message, "Check the --file path, type and size.");
|
|
7074
7152
|
return;
|
|
@@ -7672,4 +7750,4 @@ var registerCommands = async (program2) => {
|
|
|
7672
7750
|
|
|
7673
7751
|
export { Command, metadata, registerCommands };
|
|
7674
7752
|
|
|
7675
|
-
//# debugId=
|
|
7753
|
+
//# debugId=6195DA567FBC432E64756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/automation-hub-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.201.0
|
|
4
|
+
"version": "1.201.0",
|
|
5
5
|
"description": "Automation Hub — automation ideas, pipeline, taxonomy and users.",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "7933378ad5276ac369900293a1447474dcec6826"
|
|
30
30
|
}
|