@uipath/integrationservice-tool 1.202.0-preview.159 → 1.203.0-preview.160
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/README.md +48 -2
- package/dist/index.js +1 -1
- package/dist/{tool-g0b4yrm4.js → tool-f7xtwj1c.js} +568 -82
- package/dist/tool.js +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -234,6 +234,7 @@ Commands:
|
|
|
234
234
|
update <connector-key> <object-name> Update a record
|
|
235
235
|
replace <connector-key> <object-name> Replace a record
|
|
236
236
|
delete <connector-key> <object-name> Delete a record
|
|
237
|
+
script Run an action script against a connection
|
|
237
238
|
```
|
|
238
239
|
|
|
239
240
|
**Create a record:**
|
|
@@ -291,13 +292,57 @@ uip is resources run delete uipath-zoho-desk tickets \
|
|
|
291
292
|
--query "id=123"
|
|
292
293
|
```
|
|
293
294
|
|
|
294
|
-
**Available Options (
|
|
295
|
+
**Available Options (CRUDS run subcommands):**
|
|
295
296
|
- `--connection-id <id>` - Connection/Instance ID (required)
|
|
296
297
|
- `--body <json>` - Request body as JSON string (required for create, update, replace)
|
|
297
298
|
- `--query <params>` - Query parameters as key=value pairs, separated by `&`
|
|
298
299
|
- `-t, --tenant <name>` - Specify tenant (optional)
|
|
299
300
|
- `--output <format>` - Output format: table, json, yaml, plain (default: json)
|
|
300
301
|
|
|
302
|
+
#### Run an Activity Script
|
|
303
|
+
|
|
304
|
+
`run script` does not go through the v3 element-instance route. It posts a
|
|
305
|
+
request body for running the script (`POST /elements_/v4/execute`), which resolves
|
|
306
|
+
the connection's credential, so no token is handled by the CLI or
|
|
307
|
+
visible to the script. It takes no positional arguments: the connection is the
|
|
308
|
+
target, and the connector key is only needed to resolve a published script.
|
|
309
|
+
|
|
310
|
+
Pick exactly one script source:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
# A local script file: any value ending in .js is read from disk. --body is
|
|
314
|
+
# the script's input, read as context.request.body.
|
|
315
|
+
uip is resources run script --connection-id <id> \
|
|
316
|
+
--inline-script ./ChannelArchive.js \
|
|
317
|
+
--body '{"channel":"C0A66HP9KKM"}'
|
|
318
|
+
|
|
319
|
+
# A published script, by reference. --connector-key is required here.
|
|
320
|
+
uip is resources run script --connection-id <id> \
|
|
321
|
+
--connector-key uipath-salesforce-slack \
|
|
322
|
+
--script-ref list_usergroups \
|
|
323
|
+
--query pageSize=1000
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
There is no script-less passthrough: the CLI cannot point the connection's
|
|
327
|
+
credential at an arbitrary vendor URL. Every vendor call is made by a script.
|
|
328
|
+
|
|
329
|
+
The runtime answers with the vendor's own response, so a vendor 4xx/5xx is a
|
|
330
|
+
`Success` envelope with `Code: "ScriptExecuted"` carrying `Data.Status`,
|
|
331
|
+
`Data.Headers` and `Data.Body` (the vendor's JSON, parsed). A runtime
|
|
332
|
+
refusal is relayed the same way, with the runtime's
|
|
333
|
+
own status and its raw error body as a string. Only a request that got no answer at all (network, login) is a `Failure`.
|
|
334
|
+
Source mistakes (none, both, or `--script-ref` without `--connector-key`) are
|
|
335
|
+
`ValidationError` with exit `3`.
|
|
336
|
+
|
|
337
|
+
**Options (`run script`):**
|
|
338
|
+
- `--connection-id <id>` - Connection/Instance ID (required)
|
|
339
|
+
- `--inline-script <source>` - JavaScript source, or a path ending in `.js` to read a file
|
|
340
|
+
- `--script-ref <name>` - A published script's reference (needs `--connector-key`)
|
|
341
|
+
- `--connector-key <key>` - Connector key, required with `--script-ref`
|
|
342
|
+
- `--body <json>` - Script input, read as `context.request.body`
|
|
343
|
+
- `--query <params>` - Query parameters the script reads as `context.request.query` (`key=value&key=value` or JSON)
|
|
344
|
+
- `--header <name=value...>` - Headers the script reads as `context.request.headers`
|
|
345
|
+
|
|
301
346
|
---
|
|
302
347
|
|
|
303
348
|
## Common Options
|
|
@@ -501,7 +546,8 @@ The tool interacts with these Integration Service APIs:
|
|
|
501
546
|
| `activities list` | `GET /elements_/v3/element/elements/{key}/activities` |
|
|
502
547
|
| `resources list` | `GET /elements_/v3/element/[instances/{id}/]elements/{key}/objects` |
|
|
503
548
|
| `resources describe` | `GET /elements_/v3/element/[instances/{id}/]elements/{key}/objects/{name}/metadata` |
|
|
504
|
-
| `resources run
|
|
549
|
+
| `resources run create|list|get|update|replace|delete` | `{METHOD} /elements_/v3/element/instances/{id}/{objectName}` |
|
|
550
|
+
| `resources run script` | `POST /elements_/v4/execute` |
|
|
505
551
|
|
|
506
552
|
---
|
|
507
553
|
|
package/dist/index.js
CHANGED
|
@@ -2099,8 +2099,9 @@ var require_commander = __commonJS(function(exports) {
|
|
|
2099
2099
|
// package.json
|
|
2100
2100
|
var package_default = {
|
|
2101
2101
|
name: "@uipath/integrationservice-tool",
|
|
2102
|
+
author: "UiPath",
|
|
2102
2103
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2103
|
-
version: "1.
|
|
2104
|
+
version: "1.203.0-preview.160",
|
|
2104
2105
|
description: "Manage Integration Service connectors, connections, and triggers.",
|
|
2105
2106
|
private: false,
|
|
2106
2107
|
repository: {
|
|
@@ -2139,7 +2140,6 @@ var package_default = {
|
|
|
2139
2140
|
"@uipath/filesystem": "workspace:*",
|
|
2140
2141
|
"@uipath/integrationservice-sdk": "workspace:*",
|
|
2141
2142
|
"@types/node": "^25.5.2",
|
|
2142
|
-
"adm-zip": "^0.6.0",
|
|
2143
2143
|
fflate: "^0.8.2",
|
|
2144
2144
|
commander: "^14.0.3",
|
|
2145
2145
|
typescript: "^7.0.2"
|
|
@@ -2658,7 +2658,7 @@ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{1
|
|
|
2658
2658
|
var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
2659
2659
|
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
2660
2660
|
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
2661
|
-
var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
2661
|
+
var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
2662
2662
|
var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
|
|
2663
2663
|
var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
|
|
2664
2664
|
var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
|
|
@@ -2705,7 +2705,7 @@ var QUOTED_LITERAL_PATTERN = new RegExp([
|
|
|
2705
2705
|
`(?<![A-Za-z0-9])"(?:[^\\
|
|
2706
2706
|
]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
|
|
2707
2707
|
].join("|"), "g");
|
|
2708
|
-
var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
|
|
2708
|
+
var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
|
|
2709
2709
|
var COLLAPSED_BODY = "{…}";
|
|
2710
2710
|
var COLLAPSED_BODY_MARKER = "\x01body\x01";
|
|
2711
2711
|
var MAX_BODY_NESTING = 8;
|
|
@@ -2720,10 +2720,13 @@ function collapseJsonBodies(text) {
|
|
|
2720
2720
|
}
|
|
2721
2721
|
return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
|
|
2722
2722
|
}
|
|
2723
|
-
var TRAILING_PROSE_PUNCT =
|
|
2723
|
+
var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
|
|
2724
2724
|
function peelTrailingPunctuation(match) {
|
|
2725
|
-
|
|
2726
|
-
|
|
2725
|
+
let end = match.length;
|
|
2726
|
+
while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
|
|
2727
|
+
end -= 1;
|
|
2728
|
+
}
|
|
2729
|
+
return [match.slice(0, end), match.slice(end)];
|
|
2727
2730
|
}
|
|
2728
2731
|
function redactUrl(raw) {
|
|
2729
2732
|
try {
|
|
@@ -3026,6 +3029,22 @@ function parseHttpStatusFromMessage(message) {
|
|
|
3026
3029
|
const status = Number(match[1]);
|
|
3027
3030
|
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
3028
3031
|
}
|
|
3032
|
+
function findHttpStatusInGraph(error) {
|
|
3033
|
+
for (const node of walkErrorGraph(error)) {
|
|
3034
|
+
const response = node.response;
|
|
3035
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
3036
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
3037
|
+
return explicit;
|
|
3038
|
+
}
|
|
3039
|
+
if (typeof node.message === "string") {
|
|
3040
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
3041
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
3042
|
+
return parsed;
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
return;
|
|
3047
|
+
}
|
|
3029
3048
|
function isHtmlDocument(body) {
|
|
3030
3049
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
3031
3050
|
}
|
|
@@ -3139,7 +3158,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3139
3158
|
}
|
|
3140
3159
|
let message;
|
|
3141
3160
|
let result = "Failure";
|
|
3142
|
-
const
|
|
3161
|
+
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
3162
|
+
const classification = classifyError(classificationStatus, error);
|
|
3143
3163
|
let retry = classification.retry;
|
|
3144
3164
|
if (status === 401) {
|
|
3145
3165
|
message = DEFAULT_401;
|
|
@@ -3215,8 +3235,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3215
3235
|
details = describeThrownValue(error);
|
|
3216
3236
|
}
|
|
3217
3237
|
const context = {};
|
|
3218
|
-
if (
|
|
3219
|
-
context.httpStatus =
|
|
3238
|
+
if (classificationStatus) {
|
|
3239
|
+
context.httpStatus = classificationStatus;
|
|
3220
3240
|
}
|
|
3221
3241
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
3222
3242
|
context.errorCode = parsedBody.errorCode;
|
|
@@ -3778,7 +3798,8 @@ function readRegistryValue(keyPath, valueName) {
|
|
|
3778
3798
|
}
|
|
3779
3799
|
const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
|
|
3780
3800
|
encoding: "utf-8",
|
|
3781
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
3801
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
3802
|
+
windowsHide: true
|
|
3782
3803
|
}));
|
|
3783
3804
|
if (error) {
|
|
3784
3805
|
return "";
|
|
@@ -4460,28 +4481,32 @@ function isPlainRecord(value) {
|
|
|
4460
4481
|
const prototype = Object.getPrototypeOf(value);
|
|
4461
4482
|
return prototype === Object.prototype || prototype === null;
|
|
4462
4483
|
}
|
|
4463
|
-
function
|
|
4484
|
+
function splitPagedEnvelope(value) {
|
|
4464
4485
|
if (Array.isArray(value) || !isPlainRecord(value))
|
|
4465
4486
|
return null;
|
|
4466
|
-
const entries = Object.
|
|
4487
|
+
const entries = Object.entries(value);
|
|
4467
4488
|
if (entries.length === 0)
|
|
4468
4489
|
return null;
|
|
4469
|
-
let
|
|
4470
|
-
|
|
4471
|
-
for (const entry of entries) {
|
|
4490
|
+
let found = null;
|
|
4491
|
+
const meta = Object.create(null);
|
|
4492
|
+
for (const [key, entry] of entries) {
|
|
4472
4493
|
if (Array.isArray(entry)) {
|
|
4473
|
-
if (
|
|
4494
|
+
if (found !== null)
|
|
4474
4495
|
return null;
|
|
4475
|
-
|
|
4496
|
+
found = { key, rows: entry };
|
|
4476
4497
|
} else if (entry !== null && typeof entry === "object") {
|
|
4477
4498
|
return null;
|
|
4478
4499
|
} else {
|
|
4479
|
-
|
|
4500
|
+
meta[key] = entry;
|
|
4480
4501
|
}
|
|
4481
4502
|
}
|
|
4482
|
-
if (
|
|
4503
|
+
if (found === null || Object.keys(meta).length === 0)
|
|
4483
4504
|
return null;
|
|
4484
|
-
return
|
|
4505
|
+
return { ...found, meta };
|
|
4506
|
+
}
|
|
4507
|
+
function extractPagedRows(value) {
|
|
4508
|
+
const paged = splitPagedEnvelope(value);
|
|
4509
|
+
return paged === null ? null : paged.rows;
|
|
4485
4510
|
}
|
|
4486
4511
|
function toLowerCamelCaseKey(key) {
|
|
4487
4512
|
if (!key)
|
|
@@ -4585,6 +4610,9 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
4585
4610
|
}
|
|
4586
4611
|
break;
|
|
4587
4612
|
}
|
|
4613
|
+
case "markdown":
|
|
4614
|
+
logFn(renderMarkdown(data));
|
|
4615
|
+
break;
|
|
4588
4616
|
default: {
|
|
4589
4617
|
const hasData = "Data" in data && data.Data != null;
|
|
4590
4618
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
@@ -4609,6 +4637,10 @@ function logOutput(data, format = "json", tableRowStyle) {
|
|
|
4609
4637
|
printOutput(data, format, (msg) => sink.writeOut(`${msg}
|
|
4610
4638
|
`), needsAsciiSafeJson(sink), styleFn);
|
|
4611
4639
|
}
|
|
4640
|
+
var PLUMBING_KEYS = new Set(["code", "log"]);
|
|
4641
|
+
function isPlumbingKey(key) {
|
|
4642
|
+
return PLUMBING_KEYS.has(key.toLowerCase());
|
|
4643
|
+
}
|
|
4612
4644
|
function cellToString(val) {
|
|
4613
4645
|
return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
|
|
4614
4646
|
}
|
|
@@ -4624,7 +4656,7 @@ function wrapText(text, width) {
|
|
|
4624
4656
|
function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
4625
4657
|
if (data.length === 0)
|
|
4626
4658
|
return;
|
|
4627
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
4659
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
|
|
4628
4660
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
4629
4661
|
const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
|
|
4630
4662
|
logFn(header);
|
|
@@ -4646,7 +4678,7 @@ function isNonEmptyPlainObject(value) {
|
|
|
4646
4678
|
}
|
|
4647
4679
|
var NESTED_INDENT = " ";
|
|
4648
4680
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
4649
|
-
const keys = Object.keys(data).filter((key) => !
|
|
4681
|
+
const keys = Object.keys(data).filter((key) => !isPlumbingKey(key));
|
|
4650
4682
|
if (keys.length === 0)
|
|
4651
4683
|
return;
|
|
4652
4684
|
const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
|
|
@@ -4677,7 +4709,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
4677
4709
|
function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
|
|
4678
4710
|
if (data.length === 0)
|
|
4679
4711
|
return;
|
|
4680
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
4712
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
|
|
4681
4713
|
if (keys.length === 0)
|
|
4682
4714
|
return;
|
|
4683
4715
|
if (!process.stdout.isTTY) {
|
|
@@ -4751,6 +4783,220 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
|
|
|
4751
4783
|
logFn(`Log: ${externalLogValue}`);
|
|
4752
4784
|
}
|
|
4753
4785
|
}
|
|
4786
|
+
var MARKDOWN_MAX_CELL = 200;
|
|
4787
|
+
var MARKDOWN_MAX_DEPTH = 3;
|
|
4788
|
+
function markdownHeading(depth) {
|
|
4789
|
+
return "#".repeat(Math.min(3 + depth, 6));
|
|
4790
|
+
}
|
|
4791
|
+
var BACKTICK_RUN = /`+/g;
|
|
4792
|
+
function fencedBlock(text) {
|
|
4793
|
+
const first = text.trimStart()[0];
|
|
4794
|
+
const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
|
|
4795
|
+
const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN), (match) => match[0].length));
|
|
4796
|
+
const fence = "`".repeat(Math.max(3, longestRun + 1));
|
|
4797
|
+
return `${fence}${language}
|
|
4798
|
+
${text}
|
|
4799
|
+
${fence}`;
|
|
4800
|
+
}
|
|
4801
|
+
function collapseNewlineRuns(text) {
|
|
4802
|
+
return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
|
|
4803
|
+
`) ? " " : part).join("");
|
|
4804
|
+
}
|
|
4805
|
+
function markdownCell(value) {
|
|
4806
|
+
const text = value instanceof Date ? value.toISOString() : cellToString(value);
|
|
4807
|
+
return collapseNewlineRuns(text).replace(/\|/g, "\\|");
|
|
4808
|
+
}
|
|
4809
|
+
function markdownLabel(key) {
|
|
4810
|
+
return collapseNewlineRuns(key).replace(/[\\`*|]/g, "\\$&");
|
|
4811
|
+
}
|
|
4812
|
+
function withoutPlumbing(record) {
|
|
4813
|
+
const kept = Object.create(null);
|
|
4814
|
+
for (const [key, value] of Object.entries(record)) {
|
|
4815
|
+
if (!isPlumbingKey(key))
|
|
4816
|
+
kept[key] = value;
|
|
4817
|
+
}
|
|
4818
|
+
return kept;
|
|
4819
|
+
}
|
|
4820
|
+
function rowsWithoutPlumbing(rows) {
|
|
4821
|
+
return rows.map((row) => isPlainRecord(row) ? withoutPlumbing(row) : row);
|
|
4822
|
+
}
|
|
4823
|
+
function markdownTable(rows) {
|
|
4824
|
+
const columns = [];
|
|
4825
|
+
const seen = new Set;
|
|
4826
|
+
for (const row of rows) {
|
|
4827
|
+
for (const key of Object.keys(row)) {
|
|
4828
|
+
if (!seen.has(key)) {
|
|
4829
|
+
seen.add(key);
|
|
4830
|
+
columns.push(key);
|
|
4831
|
+
}
|
|
4832
|
+
}
|
|
4833
|
+
}
|
|
4834
|
+
if (columns.length === 0)
|
|
4835
|
+
return null;
|
|
4836
|
+
const cells = rows.map((row) => columns.map((key) => markdownCell(row[key])));
|
|
4837
|
+
if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL))) {
|
|
4838
|
+
return null;
|
|
4839
|
+
}
|
|
4840
|
+
return [
|
|
4841
|
+
`| ${columns.map(markdownLabel).join(" | ")} |`,
|
|
4842
|
+
`| ${columns.map(() => "---").join(" | ")} |`,
|
|
4843
|
+
...cells.map((row) => `| ${row.join(" | ")} |`)
|
|
4844
|
+
].join(`
|
|
4845
|
+
`);
|
|
4846
|
+
}
|
|
4847
|
+
function extractMessageSequence(rows) {
|
|
4848
|
+
const messages = [];
|
|
4849
|
+
for (const row of rows) {
|
|
4850
|
+
const message = extractSingleMessage(row);
|
|
4851
|
+
if (message === null)
|
|
4852
|
+
return null;
|
|
4853
|
+
messages.push(message);
|
|
4854
|
+
}
|
|
4855
|
+
return messages.join(`
|
|
4856
|
+
|
|
4857
|
+
`);
|
|
4858
|
+
}
|
|
4859
|
+
function markdownRows(rows, depth) {
|
|
4860
|
+
if (rows.length === 0)
|
|
4861
|
+
return "(none)";
|
|
4862
|
+
if (!isPlainObjectArray(rows)) {
|
|
4863
|
+
return rows.map((item) => `- ${markdownCell(item)}`).join(`
|
|
4864
|
+
`);
|
|
4865
|
+
}
|
|
4866
|
+
const prose = extractMessageSequence(rows);
|
|
4867
|
+
if (prose !== null)
|
|
4868
|
+
return prose;
|
|
4869
|
+
const table = markdownTable(rows);
|
|
4870
|
+
if (table !== null)
|
|
4871
|
+
return table;
|
|
4872
|
+
if (depth >= MARKDOWN_MAX_DEPTH) {
|
|
4873
|
+
return fencedBlock(JSON.stringify(rows, null, 2));
|
|
4874
|
+
}
|
|
4875
|
+
return rows.map((row, index) => [
|
|
4876
|
+
`${markdownHeading(depth)} ${index + 1}`,
|
|
4877
|
+
markdownObject(row, depth + 1)
|
|
4878
|
+
].join(`
|
|
4879
|
+
|
|
4880
|
+
`)).join(`
|
|
4881
|
+
|
|
4882
|
+
`);
|
|
4883
|
+
}
|
|
4884
|
+
function markdownObject(obj, depth) {
|
|
4885
|
+
const scalars = [];
|
|
4886
|
+
const blocks = [];
|
|
4887
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
4888
|
+
if (value === undefined)
|
|
4889
|
+
continue;
|
|
4890
|
+
const label = markdownLabel(key);
|
|
4891
|
+
if (Array.isArray(value)) {
|
|
4892
|
+
blocks.push(`${markdownHeading(depth)} ${label}
|
|
4893
|
+
|
|
4894
|
+
${markdownRows(value, depth + 1)}`);
|
|
4895
|
+
} else if (isNonEmptyPlainObject(value)) {
|
|
4896
|
+
const nested = depth < MARKDOWN_MAX_DEPTH ? markdownObject(value, depth + 1) : fencedBlock(JSON.stringify(value, null, 2));
|
|
4897
|
+
if (nested !== "") {
|
|
4898
|
+
blocks.push(`${markdownHeading(depth)} ${label}
|
|
4899
|
+
|
|
4900
|
+
${nested}`);
|
|
4901
|
+
}
|
|
4902
|
+
} else if (typeof value === "string" && value.includes(`
|
|
4903
|
+
`)) {
|
|
4904
|
+
blocks.push(`**${label}:**
|
|
4905
|
+
|
|
4906
|
+
${fencedBlock(value)}`);
|
|
4907
|
+
} else {
|
|
4908
|
+
scalars.push(`**${label}:** ${markdownCell(value)}`);
|
|
4909
|
+
}
|
|
4910
|
+
}
|
|
4911
|
+
const sections = scalars.length > 0 ? [scalars.join(`
|
|
4912
|
+
`)] : [];
|
|
4913
|
+
sections.push(...blocks);
|
|
4914
|
+
return sections.join(`
|
|
4915
|
+
|
|
4916
|
+
`);
|
|
4917
|
+
}
|
|
4918
|
+
function extractSingleMessage(payload) {
|
|
4919
|
+
if (!isPlainRecord(payload))
|
|
4920
|
+
return null;
|
|
4921
|
+
const keys = Object.keys(payload);
|
|
4922
|
+
if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
|
|
4923
|
+
return null;
|
|
4924
|
+
const value = payload[keys[0]];
|
|
4925
|
+
return typeof value === "string" ? value : null;
|
|
4926
|
+
}
|
|
4927
|
+
function markdownPayload(payload) {
|
|
4928
|
+
const message = extractSingleMessage(payload);
|
|
4929
|
+
if (message !== null)
|
|
4930
|
+
return message;
|
|
4931
|
+
if (Array.isArray(payload)) {
|
|
4932
|
+
return markdownRows(rowsWithoutPlumbing(payload), 0);
|
|
4933
|
+
}
|
|
4934
|
+
const visible = withoutPlumbing(payload);
|
|
4935
|
+
const paged = splitPagedEnvelope(visible);
|
|
4936
|
+
if (paged !== null) {
|
|
4937
|
+
const meta = markdownObject(paged.meta, 0);
|
|
4938
|
+
const rows = `${markdownHeading(0)} ${markdownLabel(paged.key)}
|
|
4939
|
+
|
|
4940
|
+
${markdownRows(rowsWithoutPlumbing(paged.rows), 1)}`;
|
|
4941
|
+
return meta === "" ? rows : `${meta}
|
|
4942
|
+
|
|
4943
|
+
${rows}`;
|
|
4944
|
+
}
|
|
4945
|
+
return markdownObject(visible, 0);
|
|
4946
|
+
}
|
|
4947
|
+
function isPaginationWorthShowing(value) {
|
|
4948
|
+
if (typeof value !== "object" || value === null)
|
|
4949
|
+
return false;
|
|
4950
|
+
const page = value;
|
|
4951
|
+
return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
|
|
4952
|
+
}
|
|
4953
|
+
function markdownEnvelopeNotes(data) {
|
|
4954
|
+
const envelope = data;
|
|
4955
|
+
const notes = [];
|
|
4956
|
+
const warning = envelope.Warning;
|
|
4957
|
+
if (typeof warning === "string" && warning !== "") {
|
|
4958
|
+
notes.push(`> **Warning:** ${warning}`);
|
|
4959
|
+
}
|
|
4960
|
+
const instructions = envelope.Instructions;
|
|
4961
|
+
if (typeof instructions === "string" && instructions !== "") {
|
|
4962
|
+
notes.push(`> ${instructions}`);
|
|
4963
|
+
}
|
|
4964
|
+
const pagination = envelope.Pagination;
|
|
4965
|
+
if (isPaginationWorthShowing(pagination)) {
|
|
4966
|
+
const body = markdownObject(pagination, 1);
|
|
4967
|
+
if (body !== "") {
|
|
4968
|
+
notes.push(`${markdownHeading(0)} Pagination
|
|
4969
|
+
|
|
4970
|
+
${body}`);
|
|
4971
|
+
}
|
|
4972
|
+
}
|
|
4973
|
+
const log = envelope.Log;
|
|
4974
|
+
if (typeof log === "string" && log !== "") {
|
|
4975
|
+
notes.push(`**Log:** ${log}`);
|
|
4976
|
+
}
|
|
4977
|
+
return notes;
|
|
4978
|
+
}
|
|
4979
|
+
function renderMarkdown(data) {
|
|
4980
|
+
if (data.Result !== RESULTS.Success) {
|
|
4981
|
+
const failure = data;
|
|
4982
|
+
const sections = [`**Failed:** ${failure.Message}`];
|
|
4983
|
+
if (failure.Data != null) {
|
|
4984
|
+
sections.push(markdownPayload(failure.Data));
|
|
4985
|
+
}
|
|
4986
|
+
if (failure.Instructions) {
|
|
4987
|
+
sections.push(`> ${failure.Instructions}`);
|
|
4988
|
+
}
|
|
4989
|
+
return sections.filter((section) => section !== "").join(`
|
|
4990
|
+
|
|
4991
|
+
`);
|
|
4992
|
+
}
|
|
4993
|
+
if (!("Data" in data) || data.Data == null) {
|
|
4994
|
+
return markdownObject(withoutPlumbing(data), 0);
|
|
4995
|
+
}
|
|
4996
|
+
return [markdownPayload(data.Data), ...markdownEnvelopeNotes(data)].filter((section) => section !== "").join(`
|
|
4997
|
+
|
|
4998
|
+
`);
|
|
4999
|
+
}
|
|
4754
5000
|
function toYaml(data) {
|
|
4755
5001
|
const codec = getYamlCodec();
|
|
4756
5002
|
if (!codec) {
|
|
@@ -6774,8 +7020,9 @@ class TextApiResponse {
|
|
|
6774
7020
|
// ../integrationservice-sdk/package.json
|
|
6775
7021
|
var package_default2 = {
|
|
6776
7022
|
name: "@uipath/integrationservice-sdk",
|
|
7023
|
+
author: "UiPath",
|
|
6777
7024
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
6778
|
-
version: "1.
|
|
7025
|
+
version: "1.203.0-preview.160",
|
|
6779
7026
|
repository: {
|
|
6780
7027
|
type: "git",
|
|
6781
7028
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -13283,16 +13530,7 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
|
|
|
13283
13530
|
errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
|
|
13284
13531
|
};
|
|
13285
13532
|
};
|
|
13286
|
-
var
|
|
13287
|
-
const fs2 = getFileSystem();
|
|
13288
|
-
const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
|
|
13289
|
-
if (!await fs2.exists(absolutePath)) {
|
|
13290
|
-
throw new Error(`Environment file not found: ${envPath}`);
|
|
13291
|
-
}
|
|
13292
|
-
const content = await fs2.readFile(absolutePath, "utf-8");
|
|
13293
|
-
if (content === null) {
|
|
13294
|
-
throw new Error(`Environment file not found: ${envPath}`);
|
|
13295
|
-
}
|
|
13533
|
+
var parseEnvContent = (content) => {
|
|
13296
13534
|
const env = {};
|
|
13297
13535
|
for (const line of content.split(`
|
|
13298
13536
|
`)) {
|
|
@@ -13313,6 +13551,18 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
13313
13551
|
}
|
|
13314
13552
|
return env;
|
|
13315
13553
|
};
|
|
13554
|
+
var loadEnvFileAsync = async ({ envPath }) => {
|
|
13555
|
+
const fs2 = getFileSystem();
|
|
13556
|
+
const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
|
|
13557
|
+
if (!await fs2.exists(absolutePath)) {
|
|
13558
|
+
throw new Error(`Environment file not found: ${envPath}`);
|
|
13559
|
+
}
|
|
13560
|
+
const content = await fs2.readFile(absolutePath, "utf-8");
|
|
13561
|
+
if (content === null) {
|
|
13562
|
+
throw new Error(`Environment file not found: ${envPath}`);
|
|
13563
|
+
}
|
|
13564
|
+
return parseEnvContent(content);
|
|
13565
|
+
};
|
|
13316
13566
|
var saveEnvFileAsync = async ({
|
|
13317
13567
|
envPath,
|
|
13318
13568
|
data,
|
|
@@ -14012,9 +14262,9 @@ var SUPPORTED_ACTIVITY_VERSIONS = [
|
|
|
14012
14262
|
ACTIVITY_VERSION_V1,
|
|
14013
14263
|
ACTIVITY_VERSION_V4
|
|
14014
14264
|
];
|
|
14015
|
-
async function getConnectorActivityMetadataV4(options, connectorKey,
|
|
14265
|
+
async function getConnectorActivityMetadataV4(options, connectorKey, objectName) {
|
|
14016
14266
|
const { baseUrl, accessToken, organizationId, tenantName } = await getValidatedAuthContext(options);
|
|
14017
|
-
const url = `${baseUrl}/${organizationId}/${tenantName}/elements_/v4/element/connectors/${encodeURIComponent(connectorKey)}/
|
|
14267
|
+
const url = `${baseUrl}/${organizationId}/${tenantName}/elements_/v4/element/connectors/${encodeURIComponent(connectorKey)}/objects/${encodeURIComponent(objectName)}/metadata`;
|
|
14018
14268
|
const response = await fetch(url, {
|
|
14019
14269
|
headers: addSdkUserAgentHeader({
|
|
14020
14270
|
Authorization: `Bearer ${accessToken}`,
|
|
@@ -14663,6 +14913,75 @@ var hasMoreElementsPages = (token) => {
|
|
|
14663
14913
|
const cursor = decodeElementsNextPageToken(token)?.providerNextPage;
|
|
14664
14914
|
return typeof cursor === "string" && cursor.length > 0 && cursor !== ELEMENTS_NEXT_PAGE_DONE;
|
|
14665
14915
|
};
|
|
14916
|
+
// ../integrationservice-sdk/src/runtime/connector-execute-helper.ts
|
|
14917
|
+
var EXECUTE_PATH = "elements_/v4/execute";
|
|
14918
|
+
function resolveExecuteUrl(ctx) {
|
|
14919
|
+
const base = ctx.baseUrl.replace(/\/+$/, "");
|
|
14920
|
+
return `${base}/${ctx.organizationId}/${ctx.tenantName}/${EXECUTE_PATH}`;
|
|
14921
|
+
}
|
|
14922
|
+
async function executeRequest(input) {
|
|
14923
|
+
const options = input.tenant ? { tenant: input.tenant } : undefined;
|
|
14924
|
+
const { baseUrl, accessToken, organizationId, tenantName } = await getValidatedAuthContext(options);
|
|
14925
|
+
const requestBody = buildRequestBody(input);
|
|
14926
|
+
const headers = {
|
|
14927
|
+
"Content-Type": "application/json",
|
|
14928
|
+
Authorization: `Bearer ${accessToken}`,
|
|
14929
|
+
"X-UIPATH-OrganizationId": organizationId,
|
|
14930
|
+
"X-UIPATH-TenantId": tenantName,
|
|
14931
|
+
"User-Agent": SDK_USER_AGENT
|
|
14932
|
+
};
|
|
14933
|
+
const url = resolveExecuteUrl({ baseUrl, organizationId, tenantName });
|
|
14934
|
+
const response = await fetch(url, {
|
|
14935
|
+
method: "POST",
|
|
14936
|
+
headers,
|
|
14937
|
+
body: JSON.stringify(requestBody)
|
|
14938
|
+
});
|
|
14939
|
+
const body = await response.text();
|
|
14940
|
+
const responseHeaders = Object.fromEntries(response.headers.entries());
|
|
14941
|
+
if (response.status < 200 || response.status >= 300) {
|
|
14942
|
+
return { status: response.status, headers: responseHeaders, body };
|
|
14943
|
+
}
|
|
14944
|
+
const envelope = parseEnvelope(body);
|
|
14945
|
+
if (envelope === undefined) {
|
|
14946
|
+
return { status: response.status, headers: responseHeaders, body };
|
|
14947
|
+
}
|
|
14948
|
+
return {
|
|
14949
|
+
status: envelope.status ?? response.status,
|
|
14950
|
+
headers: envelope.headers ?? responseHeaders,
|
|
14951
|
+
body: envelope.body ?? []
|
|
14952
|
+
};
|
|
14953
|
+
}
|
|
14954
|
+
function parseEnvelope(body) {
|
|
14955
|
+
try {
|
|
14956
|
+
const parsed = JSON.parse(body);
|
|
14957
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
14958
|
+
return;
|
|
14959
|
+
}
|
|
14960
|
+
return parsed;
|
|
14961
|
+
} catch {
|
|
14962
|
+
return;
|
|
14963
|
+
}
|
|
14964
|
+
}
|
|
14965
|
+
function buildRequestBody(input) {
|
|
14966
|
+
const context = {
|
|
14967
|
+
connectionId: input.connectionId
|
|
14968
|
+
};
|
|
14969
|
+
if (input.connectorKey) {
|
|
14970
|
+
context.connectorKey = input.connectorKey;
|
|
14971
|
+
}
|
|
14972
|
+
if (input.inlineScript !== undefined) {
|
|
14973
|
+
context.script = {
|
|
14974
|
+
inlineScript: input.inlineScript
|
|
14975
|
+
};
|
|
14976
|
+
} else if (input.scriptRef !== undefined) {
|
|
14977
|
+
context.script = { reference: input.scriptRef };
|
|
14978
|
+
}
|
|
14979
|
+
const requestBody = { context };
|
|
14980
|
+
if (input.request) {
|
|
14981
|
+
requestBody.request = input.request;
|
|
14982
|
+
}
|
|
14983
|
+
return requestBody;
|
|
14984
|
+
}
|
|
14666
14985
|
// src/helpers/activities.ts
|
|
14667
14986
|
function formatActivityList(activities) {
|
|
14668
14987
|
return activities.map((activity) => ({
|
|
@@ -14692,6 +15011,7 @@ var TTL = {
|
|
|
14692
15011
|
triggerObjects: 4 * HOUR,
|
|
14693
15012
|
triggerMetadata: 4 * HOUR
|
|
14694
15013
|
};
|
|
15014
|
+
var CONNECTORS_CACHE_SCHEMA = 2;
|
|
14695
15015
|
var memoMap = new Map;
|
|
14696
15016
|
async function resolveTenantId(tenantName) {
|
|
14697
15017
|
const key = tenantName ?? "__default__";
|
|
@@ -14730,7 +15050,7 @@ async function buildPath(parts, tenantName) {
|
|
|
14730
15050
|
function sanitizeObjectNameForFile(objectName) {
|
|
14731
15051
|
return objectName.replace(/[<>:"/\\|?*]/g, "_");
|
|
14732
15052
|
}
|
|
14733
|
-
async function readJson(filePath, ttlMs) {
|
|
15053
|
+
async function readJson(filePath, ttlMs, schema) {
|
|
14734
15054
|
if (filePath === null)
|
|
14735
15055
|
return null;
|
|
14736
15056
|
const [err, raw] = await catchError(fs2.readFile(filePath, "utf-8"));
|
|
@@ -14744,12 +15064,18 @@ async function readJson(filePath, ttlMs) {
|
|
|
14744
15064
|
return null;
|
|
14745
15065
|
if (Date.now() - envelope.cachedAt > ttlMs)
|
|
14746
15066
|
return null;
|
|
15067
|
+
if (schema !== undefined && envelope.schema !== schema)
|
|
15068
|
+
return null;
|
|
14747
15069
|
return envelope.data;
|
|
14748
15070
|
}
|
|
14749
|
-
async function writeJson(filePath, data) {
|
|
15071
|
+
async function writeJson(filePath, data, schema) {
|
|
14750
15072
|
if (filePath === null)
|
|
14751
15073
|
return;
|
|
14752
|
-
const envelope = {
|
|
15074
|
+
const envelope = {
|
|
15075
|
+
cachedAt: Date.now(),
|
|
15076
|
+
data,
|
|
15077
|
+
...schema === undefined ? {} : { schema }
|
|
15078
|
+
};
|
|
14753
15079
|
const [err] = await catchError(async () => {
|
|
14754
15080
|
await fs2.mkdir(fs2.path.dirname(filePath), { recursive: true });
|
|
14755
15081
|
await fs2.writeFile(filePath, JSON.stringify(envelope, null, 2), "utf-8");
|
|
@@ -14762,28 +15088,22 @@ function resolveCacheKey(id) {
|
|
|
14762
15088
|
return id || "_static";
|
|
14763
15089
|
}
|
|
14764
15090
|
async function readConnectors(tenantName) {
|
|
14765
|
-
return readJson(await buildPath(["connectors.json"], tenantName), TTL.connectors);
|
|
15091
|
+
return readJson(await buildPath(["connectors.json"], tenantName), TTL.connectors, CONNECTORS_CACHE_SCHEMA);
|
|
14766
15092
|
}
|
|
14767
15093
|
async function writeConnectors(connectors, tenantName) {
|
|
14768
15094
|
const compact = connectors.map((c) => ({
|
|
14769
15095
|
id: c.id,
|
|
14770
15096
|
name: c.name,
|
|
14771
15097
|
key: c.key,
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
latestVersion: c.latestVersion,
|
|
14775
|
-
lifecycleStage: c.lifecycleStage,
|
|
15098
|
+
enabled: c.enabled,
|
|
15099
|
+
lifeCycleStage: c.lifeCycleStage,
|
|
14776
15100
|
description: c.description,
|
|
14777
15101
|
hasEvents: c.hasEvents,
|
|
14778
|
-
hasCRUDs: c.hasCRUDs,
|
|
14779
|
-
hasMethods: c.hasMethods,
|
|
14780
15102
|
categories: c.categories,
|
|
14781
15103
|
tags: c.tags,
|
|
14782
|
-
authentication: c.authentication
|
|
14783
|
-
defaultAuthenticationType: c.defaultAuthenticationType,
|
|
14784
|
-
dapCompatible: c.dapCompatible
|
|
15104
|
+
authentication: c.authentication
|
|
14785
15105
|
}));
|
|
14786
|
-
await writeJson(await buildPath(["connectors.json"], tenantName), compact);
|
|
15106
|
+
await writeJson(await buildPath(["connectors.json"], tenantName), compact, CONNECTORS_CACHE_SCHEMA);
|
|
14787
15107
|
}
|
|
14788
15108
|
function connectionsFile(folderKey, allFolders) {
|
|
14789
15109
|
if (allFolders)
|
|
@@ -16024,12 +16344,8 @@ function formatConnectorList(connectors) {
|
|
|
16024
16344
|
Id: c.id,
|
|
16025
16345
|
Name: c.name,
|
|
16026
16346
|
Key: c.key,
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
CatalogActive: c.isActive ? "Yes" : "No",
|
|
16030
|
-
Version: c.latestVersion,
|
|
16031
|
-
Stage: c.lifecycleStage,
|
|
16032
|
-
DapCompatible: c.dapCompatible ? "Yes" : "No"
|
|
16347
|
+
Active: c.enabled ? "Yes" : "No",
|
|
16348
|
+
Stage: c.lifeCycleStage ?? ""
|
|
16033
16349
|
}));
|
|
16034
16350
|
}
|
|
16035
16351
|
function formatConnectorDetail(connector) {
|
|
@@ -28642,26 +28958,18 @@ var CONNECTORS_LIST_EXAMPLES = [
|
|
|
28642
28958
|
Code: "ConnectorList",
|
|
28643
28959
|
Data: [
|
|
28644
28960
|
{
|
|
28645
|
-
Id:
|
|
28961
|
+
Id: 3137,
|
|
28646
28962
|
Name: "Zoho Desk",
|
|
28647
28963
|
Key: "uipath-zoho-desk",
|
|
28648
|
-
|
|
28649
|
-
|
|
28650
|
-
CatalogActive: "No",
|
|
28651
|
-
Version: "",
|
|
28652
|
-
Stage: "",
|
|
28653
|
-
DapCompatible: "No"
|
|
28964
|
+
Active: "Yes",
|
|
28965
|
+
Stage: "GA"
|
|
28654
28966
|
},
|
|
28655
28967
|
{
|
|
28656
|
-
Id:
|
|
28968
|
+
Id: 4637,
|
|
28657
28969
|
Name: "Zoho Mail",
|
|
28658
28970
|
Key: "uipath-zoho-mail",
|
|
28659
|
-
|
|
28660
|
-
|
|
28661
|
-
CatalogActive: "No",
|
|
28662
|
-
Version: "",
|
|
28663
|
-
Stage: "",
|
|
28664
|
-
DapCompatible: "No"
|
|
28971
|
+
Active: "Yes",
|
|
28972
|
+
Stage: "GA"
|
|
28665
28973
|
}
|
|
28666
28974
|
]
|
|
28667
28975
|
}
|
|
@@ -28675,22 +28983,22 @@ var CONNECTORS_GET_EXAMPLES = [
|
|
|
28675
28983
|
Code: "Connector",
|
|
28676
28984
|
Data: [
|
|
28677
28985
|
{
|
|
28678
|
-
Id:
|
|
28986
|
+
Id: 3137,
|
|
28679
28987
|
Name: "Zoho Desk",
|
|
28680
28988
|
Key: "uipath-zoho-desk",
|
|
28681
|
-
AppName: "",
|
|
28682
|
-
Vendor: "",
|
|
28989
|
+
AppName: "desk",
|
|
28990
|
+
Vendor: "zoho",
|
|
28683
28991
|
Description: "Zoho Desk streamlines customer service, boosts agent efficiency and deliver lasting customer experiences",
|
|
28684
28992
|
Image: "https://example.com/zoho-desk/image",
|
|
28685
|
-
Active: "
|
|
28993
|
+
Active: "Yes",
|
|
28686
28994
|
HasEvents: "Yes",
|
|
28687
|
-
HasCruds: "
|
|
28995
|
+
HasCruds: "Yes",
|
|
28688
28996
|
HasMethods: "No",
|
|
28689
28997
|
HasHttpRequest: "Yes",
|
|
28690
|
-
DapCompatible: "
|
|
28998
|
+
DapCompatible: "Yes",
|
|
28691
28999
|
Categories: "IT and help desk",
|
|
28692
29000
|
Tags: "Service desk, Agents, Tickets",
|
|
28693
|
-
DocumentationUrl: "
|
|
29001
|
+
DocumentationUrl: "https://docs.uipath.com/integration-service/automation-cloud/latest/user-guide/uipath-zoho-desk"
|
|
28694
29002
|
}
|
|
28695
29003
|
]
|
|
28696
29004
|
}
|
|
@@ -29501,6 +29809,105 @@ function setMethodParameters(metadataNode, httpMethod, parameters) {
|
|
|
29501
29809
|
return cloned;
|
|
29502
29810
|
}
|
|
29503
29811
|
|
|
29812
|
+
// src/helpers/scripts-execute.ts
|
|
29813
|
+
var MODE_FLAGS = ["--inline-script", "--script-ref"];
|
|
29814
|
+
function validateMode(options) {
|
|
29815
|
+
if (!options.connectionId) {
|
|
29816
|
+
return {
|
|
29817
|
+
message: "Missing required option '--connection-id'",
|
|
29818
|
+
instructions: "Provide a connection ID: uip is connections list <connector-key> --all-folders"
|
|
29819
|
+
};
|
|
29820
|
+
}
|
|
29821
|
+
const given = [
|
|
29822
|
+
options.inlineScript !== undefined,
|
|
29823
|
+
options.scriptRef !== undefined
|
|
29824
|
+
].filter(Boolean).length;
|
|
29825
|
+
if (given === 0) {
|
|
29826
|
+
return {
|
|
29827
|
+
message: `Provide exactly one of ${MODE_FLAGS.join(", ")}`,
|
|
29828
|
+
instructions: "Use --inline-script for local script source, or --script-ref for a published script."
|
|
29829
|
+
};
|
|
29830
|
+
}
|
|
29831
|
+
if (given > 1) {
|
|
29832
|
+
return {
|
|
29833
|
+
message: `Only one of ${MODE_FLAGS.join(", ")} may be given`,
|
|
29834
|
+
instructions: "Only one script runs per call. Drop the extra flag."
|
|
29835
|
+
};
|
|
29836
|
+
}
|
|
29837
|
+
if (options.scriptRef !== undefined && !options.connectorKey) {
|
|
29838
|
+
return {
|
|
29839
|
+
message: "--script-ref requires --connector-key",
|
|
29840
|
+
instructions: "A published script is resolved by connector key and cross-checked against the connection. Add --connector-key <key>."
|
|
29841
|
+
};
|
|
29842
|
+
}
|
|
29843
|
+
return;
|
|
29844
|
+
}
|
|
29845
|
+
async function readInlineScript(value) {
|
|
29846
|
+
if (value.endsWith(".js")) {
|
|
29847
|
+
const fs3 = getFileSystem();
|
|
29848
|
+
const source = await fs3.readFile(value, "utf-8");
|
|
29849
|
+
if (source === null || source === undefined) {
|
|
29850
|
+
throw new Error(`script file not found: ${value}`);
|
|
29851
|
+
}
|
|
29852
|
+
return source;
|
|
29853
|
+
}
|
|
29854
|
+
return value;
|
|
29855
|
+
}
|
|
29856
|
+
function parseQuery(raw) {
|
|
29857
|
+
if (!raw) {
|
|
29858
|
+
return;
|
|
29859
|
+
}
|
|
29860
|
+
if (raw.trimStart().startsWith("{")) {
|
|
29861
|
+
return JSON.parse(raw);
|
|
29862
|
+
}
|
|
29863
|
+
const out = {};
|
|
29864
|
+
for (const pair of raw.split("&")) {
|
|
29865
|
+
if (!pair) {
|
|
29866
|
+
continue;
|
|
29867
|
+
}
|
|
29868
|
+
const eq = pair.indexOf("=");
|
|
29869
|
+
if (eq === -1) {
|
|
29870
|
+
out[pair] = "";
|
|
29871
|
+
continue;
|
|
29872
|
+
}
|
|
29873
|
+
out[pair.slice(0, eq)] = pair.slice(eq + 1);
|
|
29874
|
+
}
|
|
29875
|
+
return out;
|
|
29876
|
+
}
|
|
29877
|
+
function parseHeaders2(raw) {
|
|
29878
|
+
if (!raw || raw.length === 0) {
|
|
29879
|
+
return;
|
|
29880
|
+
}
|
|
29881
|
+
const out = {};
|
|
29882
|
+
for (const entry of raw) {
|
|
29883
|
+
const eq = entry.indexOf("=");
|
|
29884
|
+
if (eq > 0) {
|
|
29885
|
+
out[entry.slice(0, eq)] = entry.slice(eq + 1);
|
|
29886
|
+
}
|
|
29887
|
+
}
|
|
29888
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
29889
|
+
}
|
|
29890
|
+
function buildExecuteInput(options, inlineSource) {
|
|
29891
|
+
const query = parseQuery(options.query);
|
|
29892
|
+
const headers = parseHeaders2(options.header);
|
|
29893
|
+
const input = {
|
|
29894
|
+
connectionId: options.connectionId,
|
|
29895
|
+
connectorKey: options.connectorKey,
|
|
29896
|
+
tenant: options.tenant
|
|
29897
|
+
};
|
|
29898
|
+
if (inlineSource !== undefined) {
|
|
29899
|
+
input.inlineScript = inlineSource;
|
|
29900
|
+
} else {
|
|
29901
|
+
input.scriptRef = options.scriptRef;
|
|
29902
|
+
}
|
|
29903
|
+
input.request = {
|
|
29904
|
+
body: options.body ? JSON.parse(options.body) : undefined,
|
|
29905
|
+
query,
|
|
29906
|
+
headers
|
|
29907
|
+
};
|
|
29908
|
+
return input;
|
|
29909
|
+
}
|
|
29910
|
+
|
|
29504
29911
|
// src/commands/resources.ts
|
|
29505
29912
|
var VALID_OPERATIONS = "List, Retrieve, Create, Update, Delete, Replace";
|
|
29506
29913
|
var RESOURCES_LIST_EXAMPLES = [
|
|
@@ -29534,7 +29941,7 @@ var RESOURCES_LIST_EXAMPLES = [
|
|
|
29534
29941
|
];
|
|
29535
29942
|
var RESOURCES_DESCRIBE_EXAMPLES = [
|
|
29536
29943
|
{
|
|
29537
|
-
Description: "Describe a 4.0.0 activity by
|
|
29944
|
+
Description: "Describe a 4.0.0 activity by object name (v4 elements endpoints)",
|
|
29538
29945
|
Command: "uip is resources describe uipath-salesforce-slack add_users_to_usergroup --activity-version 4.0.0",
|
|
29539
29946
|
Output: {
|
|
29540
29947
|
Code: "ResourceMetadata",
|
|
@@ -29936,6 +30343,84 @@ async function handleExecuteAction(connectorKey, objectName, httpMethod, normali
|
|
|
29936
30343
|
}, { preserveDataKeys: true });
|
|
29937
30344
|
}
|
|
29938
30345
|
}
|
|
30346
|
+
var RUN_SCRIPT_EXAMPLES = [
|
|
30347
|
+
{
|
|
30348
|
+
Description: "Run a local action script against a connection",
|
|
30349
|
+
Command: `uip is resources run script --connection-id 849e85d8-1aa9-4d52-8bbd-20041c8f05d8 --inline-script ./ChannelArchive.js --body '{"channel":"C0A66HP9KKM"}'`,
|
|
30350
|
+
Output: {
|
|
30351
|
+
Code: "ScriptExecuted",
|
|
30352
|
+
Data: {
|
|
30353
|
+
Status: 200,
|
|
30354
|
+
Headers: { "content-type": "application/json" },
|
|
30355
|
+
Body: { ok: true, channel: "C0A66HP9KKM" }
|
|
30356
|
+
}
|
|
30357
|
+
}
|
|
30358
|
+
},
|
|
30359
|
+
{
|
|
30360
|
+
Description: "Run a published script by reference (needs the connector key)",
|
|
30361
|
+
Command: "uip is resources run script --connection-id 675e641b-70e1-401d-b652-568dfd03c1d2 --connector-key uipath-salesforce-slack --script-ref list_usergroups --query pageSize=1000",
|
|
30362
|
+
Output: {
|
|
30363
|
+
Code: "ScriptExecuted",
|
|
30364
|
+
Data: {
|
|
30365
|
+
Status: 200,
|
|
30366
|
+
Headers: { "content-type": "application/json" },
|
|
30367
|
+
Body: [
|
|
30368
|
+
{
|
|
30369
|
+
id: "SM81EET33",
|
|
30370
|
+
name: "Japan Product Translation",
|
|
30371
|
+
handle: "jp-pt-group"
|
|
30372
|
+
}
|
|
30373
|
+
]
|
|
30374
|
+
}
|
|
30375
|
+
}
|
|
30376
|
+
}
|
|
30377
|
+
];
|
|
30378
|
+
async function handleScriptAction(options) {
|
|
30379
|
+
const modeError = validateMode(options);
|
|
30380
|
+
if (modeError) {
|
|
30381
|
+
OutputFormatter.error({
|
|
30382
|
+
Result: RESULTS.ValidationError,
|
|
30383
|
+
Message: modeError.message,
|
|
30384
|
+
Instructions: modeError.instructions
|
|
30385
|
+
});
|
|
30386
|
+
processContext.exit(3);
|
|
30387
|
+
return;
|
|
30388
|
+
}
|
|
30389
|
+
let inlineSource;
|
|
30390
|
+
if (options.inlineScript !== undefined) {
|
|
30391
|
+
const [readError, source] = await catchError(readInlineScript(options.inlineScript));
|
|
30392
|
+
if (readError) {
|
|
30393
|
+
OutputFormatter.error({
|
|
30394
|
+
Result: RESULTS.Failure,
|
|
30395
|
+
Message: `Could not read the script: ${readError.message}`,
|
|
30396
|
+
Instructions: "Check the .js path, or pass the source directly."
|
|
30397
|
+
});
|
|
30398
|
+
processContext.exit(1);
|
|
30399
|
+
return;
|
|
30400
|
+
}
|
|
30401
|
+
inlineSource = source;
|
|
30402
|
+
}
|
|
30403
|
+
logger.info(`Executing script against connection ${options.connectionId}`);
|
|
30404
|
+
const [execError, result] = await catchError(executeRequest(buildExecuteInput(options, inlineSource)));
|
|
30405
|
+
if (execError) {
|
|
30406
|
+
OutputFormatter.error({
|
|
30407
|
+
Result: RESULTS.Failure,
|
|
30408
|
+
Message: `Could not reach Integration Service: ${execError.message}`,
|
|
30409
|
+
Instructions: "Check your network and login (uip login), then retry."
|
|
30410
|
+
});
|
|
30411
|
+
processContext.exit(1);
|
|
30412
|
+
return;
|
|
30413
|
+
}
|
|
30414
|
+
OutputFormatter.success({
|
|
30415
|
+
Result: RESULTS.Success,
|
|
30416
|
+
Code: "ScriptExecuted",
|
|
30417
|
+
Data: {
|
|
30418
|
+
Status: result.status,
|
|
30419
|
+
Headers: result.headers,
|
|
30420
|
+
Body: result.body
|
|
30421
|
+
}
|
|
30422
|
+
});
|
|
30423
|
+
}
|
|
29939
30424
|
var registerResourcesCommand = (program2) => {
|
|
29940
30425
|
const resources = program2.command("resources").description("Manage UiPath Integration Service resources");
|
|
29941
30426
|
resources.command("list").description("List available objects for a connector").argument("<connector-key>", "Connector key").option("--operation <operation>", `Filter by operation (${VALID_OPERATIONS})`).option("--connection-id <id>", "Connection/Instance ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--refresh", "Force re-fetch from API, ignoring cache").examples(RESOURCES_LIST_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
@@ -29999,7 +30484,7 @@ var registerResourcesCommand = (program2) => {
|
|
|
29999
30484
|
})();
|
|
30000
30485
|
OutputFormatter.emitList("ResourceList", formatResourceList(filtered), { emptyInstructions, warning });
|
|
30001
30486
|
});
|
|
30002
|
-
resources.command("describe").description("Describe object fields and operations").argument("<connector-key>", "Connector key").argument("<object-name>", "Object name
|
|
30487
|
+
resources.command("describe").description("Describe object fields and operations").argument("<connector-key>", "Connector key").argument("<object-name>", "Object name (the `objectName` from the activity's configuration JSON).").option("--connection-id <id>", "Connection/Instance ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--operation <operation>", `Filter to a single operation (${VALID_OPERATIONS})`).option("--activity-version <version>", "Activity metadata version: 1.0.0 (default, v3 elements endpoints, connection-scoped) or 4.0.0 (v4 elements endpoints, not connection-scoped). Both are addressed by object name.").option("--refresh", "Force re-fetch from API, ignoring cache").option("-f, --field <name=value>", "Parent-field value (repeatable) — runs the api-type ObjectAction (e.g. Jira GenerateSchema, Salesforce GenerateQuerySchema) and merges its custom-field response into requestFields. Requires --connection-id and --operation. If the result comes back holding only the fields you supplied, the response carries a Warning: one of the values does not exist on the connection.", (value, prev = []) => [...prev, value], []).option("--action <name>", "Explicit api-type ObjectAction name (e.g. GenerateSchema). Optional — inferred from --field rules when omitted.").examples(RESOURCES_DESCRIBE_EXAMPLES).trackedAction(processContext, async (connectorKey, objectName, options) => {
|
|
30003
30488
|
if (options.activityVersion && !SUPPORTED_ACTIVITY_VERSIONS.includes(options.activityVersion)) {
|
|
30004
30489
|
OutputFormatter.error({
|
|
30005
30490
|
Result: RESULTS.Failure,
|
|
@@ -30147,7 +30632,7 @@ var registerResourcesCommand = (program2) => {
|
|
|
30147
30632
|
}
|
|
30148
30633
|
emitResourceMetadata(metadataRecord, operation?.name, parentOnlyWarning);
|
|
30149
30634
|
});
|
|
30150
|
-
const execute = resources.command("run").description("Run data operations on a connector");
|
|
30635
|
+
const execute = resources.command("run").description("Run data operations on a connector, or an activity script against a connection");
|
|
30151
30636
|
addExecuteOptions(execute.command("create").description("Create a new record").argument("<connector-key>", "Connector key").argument("<object-name>", "Object name")).option("--body <json>", "Request body as JSON (required)").examples(RESOURCES_EXECUTE_CREATE_EXAMPLES).trackedAction(processContext, (c, o, opts) => handleExecuteAction(c, o, "POST", "POST", opts, true));
|
|
30152
30637
|
addExecuteOptions(execute.command("list").description("List all records").argument("<connector-key>", "Connector key").argument("<object-name>", "Object name")).examples(RESOURCES_EXECUTE_LIST_EXAMPLES).trackedAction(processContext, (c, o, opts) => handleExecuteAction(c, o, "GET", "GET", opts, false));
|
|
30153
30638
|
addExecuteOptions(execute.command("get").description("Get a record by ID").argument("<connector-key>", "Connector key").argument("<object-name>", "Object name")).examples(RESOURCES_EXECUTE_GET_EXAMPLES).trackedAction(processContext, (c, o, opts) => handleExecuteAction(c, o, "GET", "GETBYID", opts, false));
|
|
@@ -30158,6 +30643,7 @@ var registerResourcesCommand = (program2) => {
|
|
|
30158
30643
|
return;
|
|
30159
30644
|
await handleExecuteAction(c, o, "DELETE", "DELETE", opts, false);
|
|
30160
30645
|
});
|
|
30646
|
+
execute.command("script").description("Run an action script against a connection").option("--connection-id <id>", "Connection/Instance ID (required)").option("--connector-key <key>", "Connector key (required with --script-ref)").option("--inline-script <source>", "JavaScript source, or a path ending in .js to read a file").option("--script-ref <name>", "A published script's reference").option("--body <json>", "Script input, read by the script as context.request.body").option("--query <params>", "Query parameters (key=value&key=value or JSON)").option("--header <headers...>", "Request headers as name=value").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(RUN_SCRIPT_EXAMPLES).trackedAction(processContext, handleScriptAction);
|
|
30161
30647
|
};
|
|
30162
30648
|
// src/commands/triggers.ts
|
|
30163
30649
|
var TRIGGERS_OBJECTS_EXAMPLES = [
|
|
@@ -30639,4 +31125,4 @@ var registerCommands = async (program2) => {
|
|
|
30639
31125
|
|
|
30640
31126
|
export { Command, metadata, registerCommands };
|
|
30641
31127
|
|
|
30642
|
-
//# debugId=
|
|
31128
|
+
//# debugId=5DFA468B35CB7BFB64756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/integrationservice-tool",
|
|
3
|
+
"author": "UiPath",
|
|
3
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
4
|
-
"version": "1.
|
|
5
|
+
"version": "1.203.0-preview.160",
|
|
5
6
|
"description": "Manage Integration Service connectors, connections, and triggers.",
|
|
6
7
|
"private": false,
|
|
7
8
|
"repository": {
|
|
@@ -26,5 +27,5 @@
|
|
|
26
27
|
"files": [
|
|
27
28
|
"dist"
|
|
28
29
|
],
|
|
29
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "3a42062ba731afca4595ba9aa8a80afc9667528d"
|
|
30
31
|
}
|