@uipath/api-workflow-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/THIRD-PARTY-NOTICES.md +357 -1
- package/dist/executor-tool.js +6 -5
- package/dist/{index-sby22td6.js → index-h8cph72k.js} +1 -1
- package/dist/{index-dykdwqg2.js → index-qffm5md9.js} +4 -4
- package/dist/index-waq4trz1.js +42584 -0
- package/dist/index.js +9 -8
- package/dist/index.umd.min-fqefd9kn.js +7814 -0
- package/dist/{jmespath-231m3hyn.js → jmespath-e4a59c8w.js} +1 -1
- package/dist/{js-yaml-rtdrjz2v.js → js-yaml-69tsdrrf.js} +1 -1
- package/dist/{node-c39mc2gs.js → node-yh8xgmtz.js} +5 -5
- package/dist/packager-tool-0aacqssr.js +8944 -0
- package/dist/{packager-tool-1de529jm.js → packager-tool-1yh8g550.js} +15 -2
- package/dist/{packager-tool-wged619d.js → packager-tool-56y4axsc.js} +1157 -128
- package/dist/{packager-tool-1n0det9t.js → packager-tool-bgy9gdsp.js} +21 -3
- package/dist/{packager-tool-cbez71ck.js → packager-tool-evd1kzq2.js} +5 -3
- package/dist/{packager-tool-fm7ese0m.js → packager-tool-f7zta1kg.js} +19 -5
- package/dist/{packager-tool-1bxv1gsg.js → packager-tool-hfb7mmmf.js} +25 -13
- package/dist/{packager-tool-gg1c1x4t.js → packager-tool-kh3aq9n7.js} +256 -9094
- package/dist/{packager-tool-qh3bbws2.js → packager-tool-xak3m9vd.js} +27 -9
- package/dist/packager-tool.js +3 -3
- package/dist/tool.js +9 -8
- package/package.json +2 -2
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerPackagerFactories
|
|
3
|
-
} from "./packager-tool-
|
|
3
|
+
} from "./packager-tool-bgy9gdsp.js";
|
|
4
4
|
import {
|
|
5
5
|
WorkflowRunService,
|
|
6
6
|
getAuthContext,
|
|
7
7
|
getLoginStatusAsync
|
|
8
|
-
} from "./packager-tool-
|
|
8
|
+
} from "./packager-tool-kh3aq9n7.js";
|
|
9
9
|
import {
|
|
10
10
|
FailureOutput,
|
|
11
|
+
Option,
|
|
11
12
|
OutputFormatter,
|
|
12
13
|
RESULTS,
|
|
13
14
|
SuccessOutput,
|
|
@@ -15,15 +16,16 @@ import {
|
|
|
15
16
|
logger,
|
|
16
17
|
mapPackageMetadataOptions,
|
|
17
18
|
processContext,
|
|
19
|
+
quoteForShell,
|
|
18
20
|
registerPackageMetadataOptions,
|
|
19
21
|
unsupportedSolutionProjectType
|
|
20
|
-
} from "./packager-tool-
|
|
22
|
+
} from "./packager-tool-xak3m9vd.js";
|
|
21
23
|
import {
|
|
22
24
|
addSdkUserAgentHeader,
|
|
23
25
|
catchError,
|
|
24
26
|
getSdkUserAgentToken,
|
|
25
27
|
installSdkUserAgentHeader
|
|
26
|
-
} from "./packager-tool-
|
|
28
|
+
} from "./packager-tool-evd1kzq2.js";
|
|
27
29
|
import {
|
|
28
30
|
yaml
|
|
29
31
|
} from "./packager-tool-d3w0wn6k.js";
|
|
@@ -31,7 +33,7 @@ import {
|
|
|
31
33
|
__commonJS,
|
|
32
34
|
__require,
|
|
33
35
|
__toESM
|
|
34
|
-
} from "./packager-tool-
|
|
36
|
+
} from "./packager-tool-1yh8g550.js";
|
|
35
37
|
|
|
36
38
|
// ../../node_modules/ignore/index.js
|
|
37
39
|
var require_ignore = __commonJS(function(exports, module) {
|
|
@@ -7420,7 +7422,7 @@ var package_default = {
|
|
|
7420
7422
|
name: "@uipath/api-workflow-tool",
|
|
7421
7423
|
author: "UiPath",
|
|
7422
7424
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
7423
|
-
version: "1.
|
|
7425
|
+
version: "1.205.0-preview.258",
|
|
7424
7426
|
description: "Run UiPath API Workflows locally.",
|
|
7425
7427
|
private: false,
|
|
7426
7428
|
repository: {
|
|
@@ -8004,7 +8006,7 @@ var package_default2 = {
|
|
|
8004
8006
|
name: "@uipath/integrationservice-sdk",
|
|
8005
8007
|
author: "UiPath",
|
|
8006
8008
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
8007
|
-
version: "1.
|
|
8009
|
+
version: "1.205.0-preview.258",
|
|
8008
8010
|
repository: {
|
|
8009
8011
|
type: "git",
|
|
8010
8012
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -8040,12 +8042,13 @@ var package_default2 = {
|
|
|
8040
8042
|
devDependencies: {
|
|
8041
8043
|
"@uipath/auth": "workspace:*",
|
|
8042
8044
|
"@uipath/common": "workspace:*",
|
|
8045
|
+
"@uipath/solution-sdk": "workspace:*",
|
|
8043
8046
|
"@openapitools/openapi-generator-cli": "^2.31.1",
|
|
8044
8047
|
"@types/node": "^25.5.2",
|
|
8045
8048
|
typescript: "^7.0.2"
|
|
8046
8049
|
},
|
|
8047
8050
|
dependencies: {
|
|
8048
|
-
"@uipath/integration-service-design-time": "
|
|
8051
|
+
"@uipath/integration-service-design-time": "2.10.0"
|
|
8049
8052
|
}
|
|
8050
8053
|
};
|
|
8051
8054
|
|
|
@@ -13809,6 +13812,49 @@ async function createApiClient(ApiClass, options) {
|
|
|
13809
13812
|
const config = domain === "connections" ? await createConnectionsConfig(options) : await createElementsConfig(options);
|
|
13810
13813
|
return new ApiClass(config);
|
|
13811
13814
|
}
|
|
13815
|
+
async function runInstanceDesignAction(options, connectionOrInstanceId, method, relativeUrl, body) {
|
|
13816
|
+
const { baseUrl, accessToken, organizationId, tenantName } = await getValidatedAuthContext(options);
|
|
13817
|
+
const url = `${baseUrl}/${organizationId}/${tenantName}/elements_/v3/element/instances/${encodeURIComponent(connectionOrInstanceId)}${relativeUrl}`;
|
|
13818
|
+
const headers = addSdkUserAgentHeader({
|
|
13819
|
+
Authorization: `Bearer ${accessToken}`,
|
|
13820
|
+
Accept: "application/json",
|
|
13821
|
+
"x-uipath-source": "UiPath.CodingAgent"
|
|
13822
|
+
}, SDK_USER_AGENT);
|
|
13823
|
+
const init = { method, headers };
|
|
13824
|
+
if (body && Object.keys(body).length > 0) {
|
|
13825
|
+
headers["Content-Type"] = "application/json";
|
|
13826
|
+
init.body = JSON.stringify(body);
|
|
13827
|
+
}
|
|
13828
|
+
const response = await connectorApiFetch(url, init);
|
|
13829
|
+
const text = await response.text();
|
|
13830
|
+
let parsed;
|
|
13831
|
+
try {
|
|
13832
|
+
parsed = JSON.parse(text);
|
|
13833
|
+
} catch {
|
|
13834
|
+
parsed = text;
|
|
13835
|
+
}
|
|
13836
|
+
return {
|
|
13837
|
+
ok: response.ok,
|
|
13838
|
+
status: response.status,
|
|
13839
|
+
statusText: response.statusText,
|
|
13840
|
+
body: parsed
|
|
13841
|
+
};
|
|
13842
|
+
}
|
|
13843
|
+
var CONNECTOR_REQUEST_TIMEOUT_MS = 60000;
|
|
13844
|
+
async function connectorApiFetch(url, init) {
|
|
13845
|
+
try {
|
|
13846
|
+
return await fetch(url, {
|
|
13847
|
+
...init,
|
|
13848
|
+
redirect: "manual",
|
|
13849
|
+
signal: AbortSignal.timeout(CONNECTOR_REQUEST_TIMEOUT_MS)
|
|
13850
|
+
});
|
|
13851
|
+
} catch (e) {
|
|
13852
|
+
if (e instanceof Error && e.name === "TimeoutError") {
|
|
13853
|
+
throw new Error(`Request timed out after ${CONNECTOR_REQUEST_TIMEOUT_MS / 1000}s: ${url}. Check connectivity to the tenant and retry.`);
|
|
13854
|
+
}
|
|
13855
|
+
throw e;
|
|
13856
|
+
}
|
|
13857
|
+
}
|
|
13812
13858
|
// ../integrationservice-sdk/src/connection-state.ts
|
|
13813
13859
|
var CONNECTION_STATE_NAMES = new Map([
|
|
13814
13860
|
[ConnectionState.Enabled, "Enabled"],
|
|
@@ -13823,8 +13869,380 @@ var VALID_HTTP_METHODS = new Set(["GET", "POST", "PUT", "PATCH", "DELETE"]);
|
|
|
13823
13869
|
function normalizeHttpMethod(rawMethod) {
|
|
13824
13870
|
return rawMethod.toUpperCase() === "GETBYID" ? "GET" : rawMethod;
|
|
13825
13871
|
}
|
|
13872
|
+
// ../integrationservice-sdk/src/metadata/design-actions.ts
|
|
13873
|
+
var DESIGN_ACTION_TYPE = "api";
|
|
13874
|
+
function apiActionRequirements(metadata, httpMethod) {
|
|
13875
|
+
return apiActionCandidates(metadata, httpMethod).map((action) => ({
|
|
13876
|
+
name: String(action.name ?? action.Name ?? ""),
|
|
13877
|
+
refFieldNames: actionRefFieldNames(action)
|
|
13878
|
+
}));
|
|
13879
|
+
}
|
|
13880
|
+
function apiActionCandidates(metadata, httpMethod) {
|
|
13881
|
+
const candidates = [];
|
|
13882
|
+
const metadataObj = metadata.metadata;
|
|
13883
|
+
const methods = metadataObj?.method;
|
|
13884
|
+
const design = methods?.[httpMethod]?.design;
|
|
13885
|
+
for (const action of design?.actions ?? []) {
|
|
13886
|
+
if (typeof action.actionType === "string" && action.actionType.toLowerCase() === DESIGN_ACTION_TYPE) {
|
|
13887
|
+
candidates.push(action);
|
|
13888
|
+
}
|
|
13889
|
+
}
|
|
13890
|
+
for (const action of metadata.objectActions ?? []) {
|
|
13891
|
+
const type = action.actionType ?? action.ActionType;
|
|
13892
|
+
if (typeof type === "string" && type.toLowerCase() === DESIGN_ACTION_TYPE) {
|
|
13893
|
+
candidates.push(action);
|
|
13894
|
+
}
|
|
13895
|
+
}
|
|
13896
|
+
return candidates;
|
|
13897
|
+
}
|
|
13898
|
+
function actionRefFieldNames(action) {
|
|
13899
|
+
const rules = action.rules ?? action.Rules ?? [];
|
|
13900
|
+
return rules.map((r) => r.refFieldName ?? r.RefFieldName).filter((n) => typeof n === "string");
|
|
13901
|
+
}
|
|
13902
|
+
function findApiAction(metadata, httpMethod, fieldValues, actionName) {
|
|
13903
|
+
return matchApiAction(apiActionCandidates(metadata, httpMethod), fieldValues, actionName);
|
|
13904
|
+
}
|
|
13905
|
+
function matchApiAction(actions, fieldValues, actionName) {
|
|
13906
|
+
let matched = null;
|
|
13907
|
+
for (const candidate of actions) {
|
|
13908
|
+
const type = candidate.actionType ?? candidate.ActionType;
|
|
13909
|
+
if (typeof type !== "string" || type.toLowerCase() !== DESIGN_ACTION_TYPE) {
|
|
13910
|
+
continue;
|
|
13911
|
+
}
|
|
13912
|
+
const name = candidate.name ?? candidate.Name;
|
|
13913
|
+
if (actionName && name !== actionName)
|
|
13914
|
+
continue;
|
|
13915
|
+
const rules = candidate.rules ?? candidate.Rules ?? [];
|
|
13916
|
+
if (!rules.every((rule) => ruleSatisfied(rule, fieldValues)))
|
|
13917
|
+
continue;
|
|
13918
|
+
matched = candidate;
|
|
13919
|
+
break;
|
|
13920
|
+
}
|
|
13921
|
+
if (!matched)
|
|
13922
|
+
return null;
|
|
13923
|
+
return normalizeAction(matched);
|
|
13924
|
+
}
|
|
13925
|
+
function ruleSatisfied(rule, fieldValues) {
|
|
13926
|
+
const fieldName = rule.refFieldName ?? rule.RefFieldName;
|
|
13927
|
+
if (typeof fieldName !== "string")
|
|
13928
|
+
return true;
|
|
13929
|
+
const value = fieldValues[fieldName];
|
|
13930
|
+
const isEmpty = value === undefined || value === "";
|
|
13931
|
+
if ((rule.isCleared ?? rule.IsCleared) === true)
|
|
13932
|
+
return isEmpty;
|
|
13933
|
+
if (isEmpty)
|
|
13934
|
+
return false;
|
|
13935
|
+
const allowed = rule.refFieldValues ?? rule.RefFieldValues;
|
|
13936
|
+
if (!Array.isArray(allowed) || allowed.length === 0)
|
|
13937
|
+
return true;
|
|
13938
|
+
return allowed.some((v) => v === "*" || String(v) === value);
|
|
13939
|
+
}
|
|
13940
|
+
function normalizeAction(action) {
|
|
13941
|
+
const apiConfig = action.apiConfiguration ?? action.ApiConfiguration;
|
|
13942
|
+
if (!apiConfig) {
|
|
13943
|
+
throw new Error(`Action '${String(action.name ?? action.Name)}' has no apiConfiguration.`);
|
|
13944
|
+
}
|
|
13945
|
+
const method = apiConfig.method ?? apiConfig.Method ?? "GET";
|
|
13946
|
+
const url = apiConfig.url ?? apiConfig.Url ?? "";
|
|
13947
|
+
let body = null;
|
|
13948
|
+
const rawBody = apiConfig.body ?? apiConfig.Body;
|
|
13949
|
+
if (rawBody && typeof rawBody === "object") {
|
|
13950
|
+
body = {};
|
|
13951
|
+
for (const [k, v] of Object.entries(rawBody)) {
|
|
13952
|
+
body[k] = String(v ?? "");
|
|
13953
|
+
}
|
|
13954
|
+
}
|
|
13955
|
+
const onSuccessRaw = action.onSuccess ?? action.OnSuccess;
|
|
13956
|
+
const remap = onSuccessRaw?.remapConfiguration ?? onSuccessRaw?.RemapConfiguration;
|
|
13957
|
+
const onSuccess = {
|
|
13958
|
+
input: remap?.input ?? remap?.Input ?? "replace",
|
|
13959
|
+
output: remap?.output ?? remap?.Output ?? "noop"
|
|
13960
|
+
};
|
|
13961
|
+
const rules = action.rules ?? action.Rules ?? [];
|
|
13962
|
+
const ruleFieldNames = rules.map((r) => r.refFieldName ?? r.RefFieldName).filter((n) => typeof n === "string");
|
|
13963
|
+
return {
|
|
13964
|
+
name: String(action.name ?? action.Name ?? ""),
|
|
13965
|
+
method: method.toUpperCase(),
|
|
13966
|
+
url,
|
|
13967
|
+
body,
|
|
13968
|
+
onSuccess,
|
|
13969
|
+
rules: ruleFieldNames
|
|
13970
|
+
};
|
|
13971
|
+
}
|
|
13972
|
+
var loadDesignTime = () => import("./index-waq4trz1.js");
|
|
13973
|
+
var RESOURCE_KEY_EXPRESSION = "resourceKey";
|
|
13974
|
+
var SAFE_RESOURCE_KEY = /^(?!\.+$)[A-Za-z0-9._:-]+$/;
|
|
13975
|
+
function sentRequest(designTime, action) {
|
|
13976
|
+
return designTime.httpMethodSupportsRequestBody(action.method) ? action : { ...action, body: null };
|
|
13977
|
+
}
|
|
13978
|
+
function assertRequestTokensResolvable(designTime, action, fieldValues, solutionResources) {
|
|
13979
|
+
for (const token of designTime.getCustomFieldsRequestTokens(action)) {
|
|
13980
|
+
if (token.expression === undefined) {
|
|
13981
|
+
const value = fieldValues[token.fieldName];
|
|
13982
|
+
if (value === undefined || value === "") {
|
|
13983
|
+
throw new Error(`Action '${action.name}' requires a value for field '${token.fieldName}'.`);
|
|
13984
|
+
}
|
|
13985
|
+
} else if (token.expression !== RESOURCE_KEY_EXPRESSION || !solutionResources[token.fieldName]) {
|
|
13986
|
+
throw new Error(`Action '${action.name}' uses expression token '{${token.token}}' which cannot be resolved from literal field values.`);
|
|
13987
|
+
}
|
|
13988
|
+
}
|
|
13989
|
+
}
|
|
13990
|
+
function toResourceSelections(designTime, action, solutionResources) {
|
|
13991
|
+
const keysInUrl = new Set(designTime.getCustomFieldsRequestTokens({ ...action, body: null }).filter((token) => token.expression === RESOURCE_KEY_EXPRESSION).map((token) => token.fieldName));
|
|
13992
|
+
const resourceSelections = {};
|
|
13993
|
+
for (const [field, resource] of Object.entries(solutionResources)) {
|
|
13994
|
+
if (keysInUrl.has(field) && !SAFE_RESOURCE_KEY.test(resource.resourceKey)) {
|
|
13995
|
+
throw new Error(`Solution resource key '${resource.resourceKey}' for '${field}' is not a plain identifier, so it cannot be sent in the design action's URL.`);
|
|
13996
|
+
}
|
|
13997
|
+
resourceSelections[field] = { key: resource.resourceKey };
|
|
13998
|
+
}
|
|
13999
|
+
return resourceSelections;
|
|
14000
|
+
}
|
|
14001
|
+
async function runDesignAction(options, connectionId, action, fieldValues, solutionResources = {}, configurationsProvider) {
|
|
14002
|
+
const designTime = await loadDesignTime();
|
|
14003
|
+
const sent = sentRequest(designTime, action);
|
|
14004
|
+
assertRequestTokensResolvable(designTime, sent, fieldValues, solutionResources);
|
|
14005
|
+
const resourceSelections = toResourceSelections(designTime, sent, solutionResources);
|
|
14006
|
+
const { url } = designTime.buildCustomFieldsRequest({
|
|
14007
|
+
apiConfiguration: sent,
|
|
14008
|
+
fieldValues: Object.fromEntries(Object.entries(fieldValues).map(([k, v]) => [
|
|
14009
|
+
k,
|
|
14010
|
+
encodeURIComponent(v)
|
|
14011
|
+
])),
|
|
14012
|
+
resourceSelections
|
|
14013
|
+
});
|
|
14014
|
+
const request = await designTime.buildCustomFieldsRequestAsync({ apiConfiguration: sent, fieldValues, resourceSelections }, configurationsProvider);
|
|
14015
|
+
const result = await runInstanceDesignAction(options, connectionId, request.method, url, request.body);
|
|
14016
|
+
if (!result.ok) {
|
|
14017
|
+
const detail = typeof result.body === "string" ? result.body : JSON.stringify(result.body);
|
|
14018
|
+
throw Object.assign(new Error(`Design action '${action.name}' failed: ${result.status} ${result.statusText} — ${detail}`), { status: result.status });
|
|
14019
|
+
}
|
|
14020
|
+
if (result.body === null || typeof result.body !== "object" || Array.isArray(result.body)) {
|
|
14021
|
+
throw new Error(`Design action '${action.name}' returned an unexpected payload shape.`);
|
|
14022
|
+
}
|
|
14023
|
+
return result.body;
|
|
14024
|
+
}
|
|
14025
|
+
function applyDesignActionRemap(baseMeta, responseMeta, httpMethod, onSuccess) {
|
|
14026
|
+
const mode = onSuccess.input?.toLowerCase() ?? "replace";
|
|
14027
|
+
const outputMode = onSuccess.output?.toLowerCase() ?? "noop";
|
|
14028
|
+
if (mode === "noop" && outputMode === "noop")
|
|
14029
|
+
return baseMeta;
|
|
14030
|
+
const merged = { ...baseMeta };
|
|
14031
|
+
merged.fields = remapFields(fieldMap(baseMeta.fields), fieldMap(responseMeta.fields), httpMethod, mode, outputMode);
|
|
14032
|
+
const baseParameters = pickMethodParameters(baseMeta, httpMethod);
|
|
14033
|
+
const responseParameters = pickMethodParameters(responseMeta, httpMethod);
|
|
14034
|
+
if (mode !== "noop" && responseParameters !== null) {
|
|
14035
|
+
const replaced = mode === "replace" ? responseParameters : mode === "prepend" ? [...responseParameters, ...baseParameters ?? []] : [...baseParameters ?? [], ...responseParameters];
|
|
14036
|
+
merged.metadata = setMethodParameters(merged.metadata, httpMethod, replaced);
|
|
14037
|
+
}
|
|
14038
|
+
return merged;
|
|
14039
|
+
}
|
|
14040
|
+
function fieldMap(fields) {
|
|
14041
|
+
if (Array.isArray(fields)) {
|
|
14042
|
+
return Object.fromEntries(fields.map((field) => [field.name, field]));
|
|
14043
|
+
}
|
|
14044
|
+
return fields ?? {};
|
|
14045
|
+
}
|
|
14046
|
+
function selectField(base, response, httpMethod, side, mode) {
|
|
14047
|
+
const hasSide = (field) => field?.method?.[httpMethod]?.[side] === true || field?.method?.[httpMethod]?.[`${side}Curated`] === true;
|
|
14048
|
+
const current = hasSide(base) ? base : undefined;
|
|
14049
|
+
const incoming = hasSide(response) ? response : undefined;
|
|
14050
|
+
if (mode === "noop")
|
|
14051
|
+
return current;
|
|
14052
|
+
if (mode === "replace")
|
|
14053
|
+
return incoming;
|
|
14054
|
+
return mode === "prepend" ? current ?? incoming : incoming ?? current;
|
|
14055
|
+
}
|
|
14056
|
+
function remapFields(base, response, httpMethod, inputMode, outputMode) {
|
|
14057
|
+
const out = {};
|
|
14058
|
+
const fields = inputMode === "prepend" ? { ...response, ...base } : { ...base, ...response };
|
|
14059
|
+
for (const key of Object.keys(fields)) {
|
|
14060
|
+
const request = selectField(base[key], response[key], httpMethod, "request", inputMode);
|
|
14061
|
+
const returned = selectField(base[key], response[key], httpMethod, "response", outputMode);
|
|
14062
|
+
const selected = request ?? returned;
|
|
14063
|
+
const methods = { ...base[key]?.method };
|
|
14064
|
+
if (!selected) {
|
|
14065
|
+
delete methods[httpMethod];
|
|
14066
|
+
if (base[key] && (!base[key].method?.[httpMethod] || Object.keys(methods).length > 0)) {
|
|
14067
|
+
out[key] = { ...base[key], method: methods };
|
|
14068
|
+
}
|
|
14069
|
+
continue;
|
|
14070
|
+
}
|
|
14071
|
+
const requestMeta = request?.method?.[httpMethod];
|
|
14072
|
+
const responseMeta = returned?.method?.[httpMethod];
|
|
14073
|
+
out[key] = {
|
|
14074
|
+
...selected,
|
|
14075
|
+
method: {
|
|
14076
|
+
...methods,
|
|
14077
|
+
[httpMethod]: {
|
|
14078
|
+
...selected.method?.[httpMethod],
|
|
14079
|
+
request: requestMeta?.request === true,
|
|
14080
|
+
requestCurated: requestMeta?.requestCurated === true,
|
|
14081
|
+
response: responseMeta?.response === true,
|
|
14082
|
+
responseCurated: responseMeta?.responseCurated === true
|
|
14083
|
+
}
|
|
14084
|
+
}
|
|
14085
|
+
};
|
|
14086
|
+
}
|
|
14087
|
+
return out;
|
|
14088
|
+
}
|
|
14089
|
+
function pickMethodParameters(metadata, httpMethod) {
|
|
14090
|
+
const metadataObj = metadata.metadata;
|
|
14091
|
+
const methods = metadataObj?.method;
|
|
14092
|
+
const methodInfo = methods?.[httpMethod];
|
|
14093
|
+
const params = methodInfo?.parameters;
|
|
14094
|
+
return Array.isArray(params) ? params : null;
|
|
14095
|
+
}
|
|
14096
|
+
function setMethodParameters(metadataNode, httpMethod, parameters) {
|
|
14097
|
+
const cloned = metadataNode && typeof metadataNode === "object" ? { ...metadataNode } : {};
|
|
14098
|
+
const methods = cloned.method ?? {};
|
|
14099
|
+
const methodInfo = methods[httpMethod] ?? {};
|
|
14100
|
+
cloned.method = {
|
|
14101
|
+
...methods,
|
|
14102
|
+
[httpMethod]: { ...methodInfo, parameters }
|
|
14103
|
+
};
|
|
14104
|
+
return cloned;
|
|
14105
|
+
}
|
|
13826
14106
|
// ../integrationservice-sdk/src/metadata/resource-metadata.ts
|
|
13827
14107
|
var CRUD_OPERATIONS = new Set(["CREATED", "UPDATED", "DELETED"]);
|
|
14108
|
+
async function fetchTriggerMetadata(api, connectorKey, operationName, objectName, connectionId) {
|
|
14109
|
+
if (connectionId) {
|
|
14110
|
+
return catchError(api.getInstanceEventObjectMetadata({
|
|
14111
|
+
connectionOrInstanceId: connectionId,
|
|
14112
|
+
elementKey: connectorKey,
|
|
14113
|
+
operationName,
|
|
14114
|
+
objectName,
|
|
14115
|
+
allFields: true
|
|
14116
|
+
}));
|
|
14117
|
+
}
|
|
14118
|
+
return catchError(api.getEventObjectMetadata({
|
|
14119
|
+
elementKey: connectorKey,
|
|
14120
|
+
operationName,
|
|
14121
|
+
objectName,
|
|
14122
|
+
allFields: true
|
|
14123
|
+
}));
|
|
14124
|
+
}
|
|
14125
|
+
function buildCompactField(fieldDef, fieldName) {
|
|
14126
|
+
const compact = {
|
|
14127
|
+
name: fieldDef.name ?? fieldName,
|
|
14128
|
+
type: fieldDef.type ?? fieldDef.dataType,
|
|
14129
|
+
displayName: fieldDef.displayName
|
|
14130
|
+
};
|
|
14131
|
+
if (fieldDef.description)
|
|
14132
|
+
compact.description = fieldDef.description;
|
|
14133
|
+
if (fieldDef.reference)
|
|
14134
|
+
compact.reference = fieldDef.reference;
|
|
14135
|
+
if (Array.isArray(fieldDef.enum) && fieldDef.enum.length > 0) {
|
|
14136
|
+
compact.enum = fieldDef.enum.map((e) => e.value ?? e);
|
|
14137
|
+
}
|
|
14138
|
+
return compact;
|
|
14139
|
+
}
|
|
14140
|
+
function buildTriggerCompactSummary(metadata, operationName) {
|
|
14141
|
+
const fields = metadata.fields ?? {};
|
|
14142
|
+
const eventParameters = [];
|
|
14143
|
+
const filterFields = [];
|
|
14144
|
+
const outputFields = [];
|
|
14145
|
+
for (const [fieldName, fieldDef] of Object.entries(fields)) {
|
|
14146
|
+
const compact = buildCompactField(fieldDef, fieldName);
|
|
14147
|
+
outputFields.push({ ...compact });
|
|
14148
|
+
const events = fieldDef.events;
|
|
14149
|
+
if (events?.[operationName]) {
|
|
14150
|
+
const eventDef = events[operationName];
|
|
14151
|
+
const overrides = eventDef.designOverrides;
|
|
14152
|
+
eventParameters.push({
|
|
14153
|
+
...compact,
|
|
14154
|
+
displayName: overrides?.displayName ?? compact.displayName,
|
|
14155
|
+
description: overrides?.description ?? compact.description,
|
|
14156
|
+
required: eventDef.required === true
|
|
14157
|
+
});
|
|
14158
|
+
}
|
|
14159
|
+
if (fieldDef.order === 1 || fieldDef.isCuratedEventField === true) {
|
|
14160
|
+
filterFields.push({ ...compact });
|
|
14161
|
+
}
|
|
14162
|
+
}
|
|
14163
|
+
return {
|
|
14164
|
+
name: metadata.name,
|
|
14165
|
+
displayName: metadata.displayName,
|
|
14166
|
+
elementKey: metadata.elementKey,
|
|
14167
|
+
operation: operationName,
|
|
14168
|
+
eventMode: metadata.eventMode,
|
|
14169
|
+
byoaConnection: metadata.byoaConnection === true,
|
|
14170
|
+
isWebhookUrlVisible: metadata.isWebhookUrlVisible === true,
|
|
14171
|
+
eventParameters,
|
|
14172
|
+
filterFields,
|
|
14173
|
+
outputFields
|
|
14174
|
+
};
|
|
14175
|
+
}
|
|
14176
|
+
// src/services/start-trigger.ts
|
|
14177
|
+
var INTSVC_CALL = "UiPath.IntSvc";
|
|
14178
|
+
var INTSVC_EVENT_CALL = "UiPath.IntSvcEvent";
|
|
14179
|
+
var CONNECTION_PLACEHOLDER = "<REPLACE_WITH_VENDOR_CONNECTION_UUID>";
|
|
14180
|
+
var ENDPOINT_LOCATIONS = new Set([
|
|
14181
|
+
"path",
|
|
14182
|
+
"query"
|
|
14183
|
+
]);
|
|
14184
|
+
var TRIGGER_ACTIVITY_TYPES = new Set(["CuratedTrigger", "GenericTrigger"]);
|
|
14185
|
+
function isTriggerActivityType(activityType) {
|
|
14186
|
+
return TRIGGER_ACTIVITY_TYPES.has(activityType);
|
|
14187
|
+
}
|
|
14188
|
+
function isStartTriggerTask(task) {
|
|
14189
|
+
if (!isRecord(task) || task.call !== INTSVC_EVENT_CALL)
|
|
14190
|
+
return false;
|
|
14191
|
+
const metadata = isRecord(task.metadata) ? task.metadata : undefined;
|
|
14192
|
+
const activityType = readInstanceParameters(metadata?.configuration)?.activityType;
|
|
14193
|
+
return typeof activityType !== "string" || isTriggerActivityType(activityType);
|
|
14194
|
+
}
|
|
14195
|
+
function readEssentialConfiguration(configuration, onParseError) {
|
|
14196
|
+
if (typeof configuration !== "string" || configuration.length === 0) {
|
|
14197
|
+
return null;
|
|
14198
|
+
}
|
|
14199
|
+
const [error, parsed] = catchError(() => JSON.parse(configuration));
|
|
14200
|
+
if (error) {
|
|
14201
|
+
onParseError?.(error);
|
|
14202
|
+
return null;
|
|
14203
|
+
}
|
|
14204
|
+
const essential = isRecord(parsed) ? parsed.essentialConfiguration : null;
|
|
14205
|
+
return isRecord(essential) ? essential : null;
|
|
14206
|
+
}
|
|
14207
|
+
function readInstanceParameters(configuration, onParseError) {
|
|
14208
|
+
const instanceParameters = readEssentialConfiguration(configuration, onParseError)?.instanceParameters;
|
|
14209
|
+
return isRecord(instanceParameters) ? instanceParameters : null;
|
|
14210
|
+
}
|
|
14211
|
+
function startTriggerSlot(workflow) {
|
|
14212
|
+
const root = workflow?.do;
|
|
14213
|
+
if (!Array.isArray(root))
|
|
14214
|
+
return null;
|
|
14215
|
+
const sequence = firstValue(root[0]);
|
|
14216
|
+
const steps = sequence?.do;
|
|
14217
|
+
if (!Array.isArray(steps) || steps.length < 2)
|
|
14218
|
+
return null;
|
|
14219
|
+
const start = steps[0];
|
|
14220
|
+
if (!isRecord(start) || !("WorkflowStart" in start))
|
|
14221
|
+
return null;
|
|
14222
|
+
return firstValue(steps[1]);
|
|
14223
|
+
}
|
|
14224
|
+
function walkTasks(node, path, visit) {
|
|
14225
|
+
if (Array.isArray(node)) {
|
|
14226
|
+
for (let i = 0;i < node.length; i++) {
|
|
14227
|
+
walkTasks(node[i], `${path}/${i}`, visit);
|
|
14228
|
+
}
|
|
14229
|
+
return;
|
|
14230
|
+
}
|
|
14231
|
+
if (!isRecord(node))
|
|
14232
|
+
return;
|
|
14233
|
+
for (const [key, value] of Object.entries(node)) {
|
|
14234
|
+
const childPath = `${path}/${key}`;
|
|
14235
|
+
visit(key, value, childPath);
|
|
14236
|
+
walkTasks(value, childPath, visit);
|
|
14237
|
+
}
|
|
14238
|
+
}
|
|
14239
|
+
function firstValue(entry) {
|
|
14240
|
+
return isRecord(entry) ? Object.values(entry)[0] ?? null : null;
|
|
14241
|
+
}
|
|
14242
|
+
function isRecord(value) {
|
|
14243
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
14244
|
+
}
|
|
14245
|
+
|
|
13828
14246
|
// src/services/typecache-api.ts
|
|
13829
14247
|
var TYPECACHE_BASE_PARAMS = {
|
|
13830
14248
|
withActivities: "true",
|
|
@@ -13847,12 +14265,26 @@ async function getAuthContext2() {
|
|
|
13847
14265
|
if (loginStatus.tenantId) {
|
|
13848
14266
|
headers["X-Uipath-Tenantid"] = loginStatus.tenantId;
|
|
13849
14267
|
}
|
|
14268
|
+
const apiRoot = `${loginStatus.baseUrl}/${loginStatus.organizationId}/studio_/typecache/api`;
|
|
13850
14269
|
return {
|
|
13851
|
-
typecacheBaseUrl: `${
|
|
14270
|
+
typecacheBaseUrl: `${apiRoot}/Activities`,
|
|
14271
|
+
triggersBaseUrl: `${apiRoot}/Triggers`,
|
|
13852
14272
|
headers
|
|
13853
14273
|
};
|
|
13854
14274
|
}
|
|
13855
|
-
|
|
14275
|
+
function searchActivitiesRemote(keyword, serverLimit, options) {
|
|
14276
|
+
return searchCatalog(keyword, serverLimit, options, {
|
|
14277
|
+
noun: "activities",
|
|
14278
|
+
errorLabel: "TypeCache search failed"
|
|
14279
|
+
});
|
|
14280
|
+
}
|
|
14281
|
+
function searchTriggersRemote(keyword, serverLimit, options) {
|
|
14282
|
+
return searchCatalog(keyword, serverLimit, options, {
|
|
14283
|
+
noun: "triggers",
|
|
14284
|
+
errorLabel: "TypeCache trigger search failed"
|
|
14285
|
+
});
|
|
14286
|
+
}
|
|
14287
|
+
async function searchCatalog(keyword, serverLimit, options, catalog) {
|
|
13856
14288
|
const ctx = await getAuthContext2();
|
|
13857
14289
|
const query = new URLSearchParams({
|
|
13858
14290
|
...TYPECACHE_BASE_PARAMS,
|
|
@@ -13860,17 +14292,23 @@ async function searchActivitiesRemote(keyword, serverLimit, options) {
|
|
|
13860
14292
|
"pagingOptions.Limit": String(serverLimit),
|
|
13861
14293
|
...options?.indexed ? { useElastic: "true", useLucene: "true" } : {}
|
|
13862
14294
|
});
|
|
13863
|
-
const
|
|
13864
|
-
|
|
14295
|
+
const isTriggers = catalog.noun === "triggers";
|
|
14296
|
+
if (isTriggers) {
|
|
14297
|
+
query.append("types", "Integrated");
|
|
14298
|
+
query.append("types", "System");
|
|
14299
|
+
}
|
|
14300
|
+
const url = isTriggers ? `${ctx.triggersBaseUrl}/SearchTriggers?${query}` : `${ctx.typecacheBaseUrl}/SearchActivities?${query}`;
|
|
14301
|
+
logger.debug(`Searching TypeCache ${catalog.noun}: ${url}`);
|
|
13865
14302
|
const response = await fetch(url, { method: "GET", headers: ctx.headers });
|
|
13866
14303
|
if (!response.ok) {
|
|
13867
14304
|
const errorText = await response.text();
|
|
13868
|
-
throw new Error(
|
|
14305
|
+
throw new Error(`${catalog.errorLabel}: ${response.status} ${response.statusText} - ${errorText}`);
|
|
13869
14306
|
}
|
|
13870
14307
|
const data = await response.json();
|
|
13871
|
-
const
|
|
13872
|
-
|
|
13873
|
-
|
|
14308
|
+
const items = data[catalog.noun] ?? [];
|
|
14309
|
+
const total = data[isTriggers ? "totalTriggers" : "totalActivities"] ?? items.length;
|
|
14310
|
+
logger.debug(`TypeCache returned ${items.length} of ${total} ${catalog.noun} for keyword '${keyword}'`);
|
|
14311
|
+
return items;
|
|
13874
14312
|
}
|
|
13875
14313
|
async function fetchActivityById(activityTypeId) {
|
|
13876
14314
|
const ctx = await getAuthContext2();
|
|
@@ -13909,43 +14347,118 @@ var HTTP_CONNECTOR_KEY = "uipath-uipath-http";
|
|
|
13909
14347
|
function isHiddenParameter(p) {
|
|
13910
14348
|
return p.design?.isHidden === true;
|
|
13911
14349
|
}
|
|
13912
|
-
async function
|
|
14350
|
+
async function fetchTriggerEnrichment(args) {
|
|
14351
|
+
const [clientError, api] = await catchError(createApiClient(ElementsApi, {}));
|
|
14352
|
+
if (clientError || !api) {
|
|
14353
|
+
logger.warn(`Could not create Integration Service client: ${clientError?.message}`);
|
|
14354
|
+
return null;
|
|
14355
|
+
}
|
|
14356
|
+
const [callError, tuple] = await catchError(fetchTriggerMetadata(api, args.connectorKey, args.eventOperation, args.objectName, args.connectionId));
|
|
14357
|
+
const [error, raw] = callError ? [callError, undefined] : tuple;
|
|
14358
|
+
if (error || raw == null) {
|
|
14359
|
+
logger.warn(`Could not fetch trigger metadata for ${args.connectorKey}/${args.eventOperation}/${args.objectName}: ${error?.message}`);
|
|
14360
|
+
return null;
|
|
14361
|
+
}
|
|
14362
|
+
const summary = buildTriggerCompactSummary(raw, args.eventOperation);
|
|
14363
|
+
const rawFields = new Map(normalizeFieldList(raw.fields).map((f) => [
|
|
14364
|
+
f.name,
|
|
14365
|
+
f
|
|
14366
|
+
]));
|
|
14367
|
+
return {
|
|
14368
|
+
eventMode: asString(summary.eventMode),
|
|
14369
|
+
eventParameters: compactFields(summary.eventParameters).map((field) => ({
|
|
14370
|
+
...toIsField(field),
|
|
14371
|
+
required: field.required === true,
|
|
14372
|
+
location: rawFields.get(field.name)?.fieldLocation,
|
|
14373
|
+
subBinding: rawFields.get(field.name)?.design?.exposeAsSubBinding === true
|
|
14374
|
+
})),
|
|
14375
|
+
filterFields: compactFields(summary.filterFields).map(toIsField),
|
|
14376
|
+
outputFields: compactFields(summary.outputFields).map(toIsField)
|
|
14377
|
+
};
|
|
14378
|
+
}
|
|
14379
|
+
function compactFields(value) {
|
|
14380
|
+
return Array.isArray(value) ? value : [];
|
|
14381
|
+
}
|
|
14382
|
+
function toIsField(field) {
|
|
14383
|
+
return {
|
|
14384
|
+
name: field.name,
|
|
14385
|
+
displayName: asString(field.displayName),
|
|
14386
|
+
type: asString(field.type),
|
|
14387
|
+
description: asString(field.description)
|
|
14388
|
+
};
|
|
14389
|
+
}
|
|
14390
|
+
function asString(value) {
|
|
14391
|
+
return typeof value === "string" ? value : undefined;
|
|
14392
|
+
}
|
|
14393
|
+
async function searchActivities(keyword, limit = 50, kind = "all") {
|
|
13913
14394
|
const tokens = keyword.toLowerCase().split(/\s+/).filter(Boolean);
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
14395
|
+
const fallbackKeyword = tokens.length > 1 ? tokens.reduce((longest, token) => token.length > longest.length ? token : longest, tokens[0]) : keyword;
|
|
14396
|
+
const fetchPage = async (fetcher) => {
|
|
14397
|
+
const indexed = await fetcher(keyword, limit, { indexed: true });
|
|
14398
|
+
if (indexed.length > 0)
|
|
14399
|
+
return indexed;
|
|
14400
|
+
return fetcher(fallbackKeyword, limit);
|
|
14401
|
+
};
|
|
14402
|
+
const warnings = [];
|
|
14403
|
+
const [activityPage, triggerPage] = await Promise.all([
|
|
14404
|
+
kind === "trigger" ? [] : fetchPage(searchActivitiesRemote),
|
|
14405
|
+
fetchTriggerPage(kind, fetchPage, warnings)
|
|
14406
|
+
]);
|
|
14407
|
+
const candidates = [];
|
|
14408
|
+
for (let i = 0;i < Math.max(activityPage.length, triggerPage.length); i++) {
|
|
14409
|
+
const activity = activityPage[i];
|
|
14410
|
+
if (activity)
|
|
14411
|
+
candidates.push({ entry: activity, kind: "activity" });
|
|
14412
|
+
const trigger = triggerPage[i];
|
|
14413
|
+
if (trigger)
|
|
14414
|
+
candidates.push({ entry: trigger, kind: "trigger" });
|
|
13920
14415
|
}
|
|
13921
14416
|
const matches = [];
|
|
13922
|
-
for (const
|
|
13923
|
-
const config = parseConfig(
|
|
14417
|
+
for (const { entry, kind: entryKind } of candidates) {
|
|
14418
|
+
const config = parseConfig(entry);
|
|
13924
14419
|
if (!config)
|
|
13925
14420
|
continue;
|
|
13926
14421
|
const haystack = [
|
|
13927
|
-
|
|
13928
|
-
|
|
14422
|
+
entry.displayName,
|
|
14423
|
+
entry.description,
|
|
13929
14424
|
config.connectorKey,
|
|
13930
14425
|
config.objectName,
|
|
13931
|
-
|
|
14426
|
+
config.eventOperation,
|
|
14427
|
+
entry.fullName
|
|
13932
14428
|
].filter(Boolean).join(" ").toLowerCase();
|
|
13933
14429
|
if (!tokens.every((token) => haystack.includes(token)))
|
|
13934
14430
|
continue;
|
|
13935
14431
|
matches.push({
|
|
13936
|
-
uiPathActivityTypeId:
|
|
13937
|
-
displayName:
|
|
13938
|
-
description:
|
|
14432
|
+
uiPathActivityTypeId: entry.uiPathActivityTypeId,
|
|
14433
|
+
displayName: entry.displayName,
|
|
14434
|
+
description: entry.description,
|
|
13939
14435
|
connectorKey: config.connectorKey,
|
|
13940
14436
|
objectName: config.objectName,
|
|
13941
14437
|
httpMethod: config.httpMethod,
|
|
13942
14438
|
activityType: config.activityType,
|
|
13943
|
-
operation: config.operation ?? null
|
|
14439
|
+
operation: config.operation ?? null,
|
|
14440
|
+
kind: entryKind,
|
|
14441
|
+
...entryKind === "trigger" ? {
|
|
14442
|
+
eventOperation: config.eventOperation ?? null,
|
|
14443
|
+
eventMode: config.eventMode ?? null
|
|
14444
|
+
} : {}
|
|
13944
14445
|
});
|
|
13945
14446
|
if (matches.length >= limit)
|
|
13946
14447
|
break;
|
|
13947
14448
|
}
|
|
13948
|
-
return matches;
|
|
14449
|
+
return { matches, warnings };
|
|
14450
|
+
}
|
|
14451
|
+
async function fetchTriggerPage(kind, fetchPage, warnings) {
|
|
14452
|
+
if (kind === "activity")
|
|
14453
|
+
return [];
|
|
14454
|
+
if (kind === "trigger")
|
|
14455
|
+
return fetchPage(searchTriggersRemote);
|
|
14456
|
+
const [error, page] = await catchError(fetchPage(searchTriggersRemote));
|
|
14457
|
+
if (error) {
|
|
14458
|
+
warnings.push(`Trigger catalog skipped: ${error.message}. Only activities were searched.`);
|
|
14459
|
+
return [];
|
|
14460
|
+
}
|
|
14461
|
+
return page;
|
|
13949
14462
|
}
|
|
13950
14463
|
async function findActivityByGuid(activityTypeId) {
|
|
13951
14464
|
const activity = await fetchActivityById(activityTypeId);
|
|
@@ -14001,14 +14514,23 @@ async function fetchIsEnrichment(args) {
|
|
|
14001
14514
|
logger.warn(`Object '${objectName}' on connector '${connectorKey}' has no '${operation}' operation. Available operations: ${available || "none"}.`);
|
|
14002
14515
|
return null;
|
|
14003
14516
|
}
|
|
14004
|
-
const [methodKey
|
|
14517
|
+
const [methodKey] = operationMatch ?? [
|
|
14005
14518
|
httpMethod,
|
|
14006
14519
|
metadata?.metadata?.method?.[httpMethod]
|
|
14007
14520
|
];
|
|
14521
|
+
const resolvedMetadata = await resolveDesignActionMetadata({
|
|
14522
|
+
metadata,
|
|
14523
|
+
methodKey,
|
|
14524
|
+
connectionId,
|
|
14525
|
+
inputs: args.inputs,
|
|
14526
|
+
warnings: args.warnings,
|
|
14527
|
+
label: `${connectorKey}/${objectName}`
|
|
14528
|
+
});
|
|
14529
|
+
const methodInfo = resolvedMetadata?.metadata?.method?.[methodKey];
|
|
14008
14530
|
const path = methodInfo?.path ?? `/${objectName}`;
|
|
14009
14531
|
const parameters = methodInfo?.parameters ?? [];
|
|
14010
14532
|
const multipart = parameters.some((p) => p.type === "multipart");
|
|
14011
|
-
const fieldList = normalizeFieldList(
|
|
14533
|
+
const fieldList = normalizeFieldList(resolvedMetadata?.fields);
|
|
14012
14534
|
const requestFields = [];
|
|
14013
14535
|
const responseFields = [];
|
|
14014
14536
|
const solutionResourceFields = [];
|
|
@@ -14023,7 +14545,7 @@ async function fetchIsEnrichment(args) {
|
|
|
14023
14545
|
required: methodMeta.required === true,
|
|
14024
14546
|
description: field.description
|
|
14025
14547
|
};
|
|
14026
|
-
if (methodMeta.request === true || methodMeta.requestCurated === true) {
|
|
14548
|
+
if (field.design?.isHidden !== true && (methodMeta.request === true || methodMeta.requestCurated === true)) {
|
|
14027
14549
|
requestFields.push(compact);
|
|
14028
14550
|
if (field.design?.component === "Resources" && typeof field.design.solutionResourceKind === "string") {
|
|
14029
14551
|
solutionResourceFields.push({
|
|
@@ -14049,6 +14571,75 @@ async function fetchIsEnrichment(args) {
|
|
|
14049
14571
|
solutionResourceFields
|
|
14050
14572
|
};
|
|
14051
14573
|
}
|
|
14574
|
+
async function resolveDesignActionMetadata(args) {
|
|
14575
|
+
const [error, resolved] = await catchError(() => runSchemaDesignAction(args));
|
|
14576
|
+
if (error) {
|
|
14577
|
+
args.warnings?.push(`${args.label}: ${error.message} RequestFields and ResponseFields show only the static schema.`);
|
|
14578
|
+
return args.metadata;
|
|
14579
|
+
}
|
|
14580
|
+
return resolved;
|
|
14581
|
+
}
|
|
14582
|
+
async function runSchemaDesignAction(args) {
|
|
14583
|
+
const { metadata, methodKey, connectionId, warnings, label } = args;
|
|
14584
|
+
const record = metadata;
|
|
14585
|
+
const required = apiActionRequirements(record, methodKey).filter((a) => a.refFieldNames.length > 0);
|
|
14586
|
+
if (required.length === 0)
|
|
14587
|
+
return metadata;
|
|
14588
|
+
const fieldValues = {};
|
|
14589
|
+
for (const [name, value] of Object.entries(args.inputs ?? {})) {
|
|
14590
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
14591
|
+
fieldValues[name] = String(value);
|
|
14592
|
+
}
|
|
14593
|
+
}
|
|
14594
|
+
const action = findApiAction(record, methodKey, fieldValues);
|
|
14595
|
+
if (!action || action.rules.length === 0) {
|
|
14596
|
+
const options = required.map((a) => `'${a.name}' needs ${a.refFieldNames.map((n) => `'${n}'`).join(" and ")}`).join("; ");
|
|
14597
|
+
warnings?.push(`${label}: its schema comes from a design action (${options}). Supply one action's fields in --inputs${connectionId ? "" : ", with a --connection-id"}; until then RequestFields and ResponseFields show only the static schema.`);
|
|
14598
|
+
return metadata;
|
|
14599
|
+
}
|
|
14600
|
+
if (!connectionId) {
|
|
14601
|
+
warnings?.push(`${label}: design action '${action.name}' runs on a connection; pass --connection-id to resolve the fields it returns.`);
|
|
14602
|
+
return metadata;
|
|
14603
|
+
}
|
|
14604
|
+
const response = await runDesignAction({}, connectionId, action, fieldValues);
|
|
14605
|
+
const remapsInput = action.onSuccess.input.toLowerCase() !== "noop";
|
|
14606
|
+
const remapsOutput = action.onSuccess.output.toLowerCase() !== "noop";
|
|
14607
|
+
const returnsFields = normalizeFieldList(response.fields).some((field) => {
|
|
14608
|
+
const meta = field.method?.[methodKey];
|
|
14609
|
+
return remapsInput && (meta?.request === true || meta?.requestCurated === true) || remapsOutput && (meta?.response === true || meta?.responseCurated === true);
|
|
14610
|
+
});
|
|
14611
|
+
const returnsParameters = remapsInput && (response.metadata?.method?.[methodKey]?.parameters?.length ?? 0) > 0;
|
|
14612
|
+
if ((remapsInput || remapsOutput) && !returnsFields && !returnsParameters) {
|
|
14613
|
+
const used = action.rules.map((name) => `${name}=${fieldValues[name]}`).join(", ");
|
|
14614
|
+
warnings?.push(`${label}: design action '${action.name}' returned no fields or parameters for ${used}. Check that the value names something this connection has.`);
|
|
14615
|
+
}
|
|
14616
|
+
const merged = applyDesignActionRemap(record, response, methodKey, action.onSuccess);
|
|
14617
|
+
return keepSuppliedRequestFields(metadata, merged, methodKey, args.inputs);
|
|
14618
|
+
}
|
|
14619
|
+
function keepSuppliedRequestFields(base, merged, methodKey, inputs) {
|
|
14620
|
+
const isRequest = (field) => {
|
|
14621
|
+
const meta = field?.method?.[methodKey];
|
|
14622
|
+
return meta?.request === true || meta?.requestCurated === true;
|
|
14623
|
+
};
|
|
14624
|
+
const mergedFields = Object.fromEntries(normalizeFieldList(merged.fields).map((f) => [f.name, f]));
|
|
14625
|
+
const kept = normalizeFieldList(base.fields).filter((field) => Object.hasOwn(inputs ?? {}, field.name) && isRequest(field) && !isRequest(mergedFields[field.name]));
|
|
14626
|
+
if (kept.length === 0)
|
|
14627
|
+
return merged;
|
|
14628
|
+
for (const field of kept) {
|
|
14629
|
+
const current = mergedFields[field.name];
|
|
14630
|
+
mergedFields[field.name] = current ? {
|
|
14631
|
+
...current,
|
|
14632
|
+
method: {
|
|
14633
|
+
...current.method,
|
|
14634
|
+
[methodKey]: {
|
|
14635
|
+
...current.method?.[methodKey],
|
|
14636
|
+
...field.method?.[methodKey]
|
|
14637
|
+
}
|
|
14638
|
+
}
|
|
14639
|
+
} : field;
|
|
14640
|
+
}
|
|
14641
|
+
return { ...merged, fields: mergedFields };
|
|
14642
|
+
}
|
|
14052
14643
|
function normalizeFieldList(fields) {
|
|
14053
14644
|
if (!fields)
|
|
14054
14645
|
return [];
|
|
@@ -14089,6 +14680,128 @@ function buildEssentialConfiguration(config, fullPath, resourceSelections) {
|
|
|
14089
14680
|
function decideKind(connectorKey) {
|
|
14090
14681
|
return connectorKey === HTTP_CONNECTOR_KEY ? "Http" : "IntSvc";
|
|
14091
14682
|
}
|
|
14683
|
+
function buildTriggerEssentialConfiguration(config) {
|
|
14684
|
+
const isGeneric = config.activityType === "GenericTrigger";
|
|
14685
|
+
return JSON.stringify({
|
|
14686
|
+
essentialConfiguration: {
|
|
14687
|
+
connectorVersion: "",
|
|
14688
|
+
executionType: null,
|
|
14689
|
+
scriptRef: null,
|
|
14690
|
+
customFieldsRequestDetails: null,
|
|
14691
|
+
instanceParameters: {
|
|
14692
|
+
connectorKey: config.connectorKey,
|
|
14693
|
+
...isGeneric ? {} : { objectName: config.objectName },
|
|
14694
|
+
activityType: config.activityType,
|
|
14695
|
+
version: config.version,
|
|
14696
|
+
eventOperation: config.eventOperation ?? null,
|
|
14697
|
+
eventMode: config.eventMode ?? null,
|
|
14698
|
+
supportsStreaming: false
|
|
14699
|
+
},
|
|
14700
|
+
objectName: config.objectName,
|
|
14701
|
+
packageVersion: config.version,
|
|
14702
|
+
httpMethod: null,
|
|
14703
|
+
path: null,
|
|
14704
|
+
filter: null
|
|
14705
|
+
}
|
|
14706
|
+
});
|
|
14707
|
+
}
|
|
14708
|
+
function deriveTriggerSlotKey(displayName, instanceNumber) {
|
|
14709
|
+
const normalized = displayName.replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
14710
|
+
return `${normalized || "Trigger"}_${instanceNumber}`;
|
|
14711
|
+
}
|
|
14712
|
+
function buildMandatoryFilterExpression(eventParameters, values) {
|
|
14713
|
+
const fragments = [];
|
|
14714
|
+
for (const parameter of eventParameters) {
|
|
14715
|
+
if (ENDPOINT_LOCATIONS.has(parameter.location ?? ""))
|
|
14716
|
+
continue;
|
|
14717
|
+
if (!Object.hasOwn(values, parameter.name))
|
|
14718
|
+
continue;
|
|
14719
|
+
const value = values[parameter.name];
|
|
14720
|
+
if (value === null || value === undefined || value === "")
|
|
14721
|
+
continue;
|
|
14722
|
+
fragments.push(`(${parameter.name} == ${formatJmesLiteral(value, parameter.type)})`);
|
|
14723
|
+
}
|
|
14724
|
+
return fragments.length > 0 ? fragments.join(" && ") : undefined;
|
|
14725
|
+
}
|
|
14726
|
+
var JMES_NUMERIC_TYPES = new Set([
|
|
14727
|
+
"number",
|
|
14728
|
+
"integer",
|
|
14729
|
+
"double",
|
|
14730
|
+
"float",
|
|
14731
|
+
"long",
|
|
14732
|
+
"int"
|
|
14733
|
+
]);
|
|
14734
|
+
function formatJmesLiteral(value, fieldType) {
|
|
14735
|
+
const type = (fieldType ?? typeof value).toLowerCase();
|
|
14736
|
+
if (type === "boolean")
|
|
14737
|
+
return `\`${String(value).toLowerCase()}\``;
|
|
14738
|
+
if (JMES_NUMERIC_TYPES.has(type))
|
|
14739
|
+
return `\`${String(value)}\``;
|
|
14740
|
+
return `'${String(value).replace(/['\\]/g, "\\$&")}'`;
|
|
14741
|
+
}
|
|
14742
|
+
var TRIGGER_BUCKETS = [
|
|
14743
|
+
["header", "headers"],
|
|
14744
|
+
["path", "pathParameters"],
|
|
14745
|
+
["query", "queryParameters"],
|
|
14746
|
+
["body", "bodyParameters"]
|
|
14747
|
+
];
|
|
14748
|
+
function bucketTriggerInputs(eventParameters, inputs) {
|
|
14749
|
+
const byLocation = new Map(TRIGGER_BUCKETS);
|
|
14750
|
+
const buckets = {};
|
|
14751
|
+
for (const bucket of [...byLocation.values(), "eventParameters"]) {
|
|
14752
|
+
buckets[bucket] = {};
|
|
14753
|
+
}
|
|
14754
|
+
for (const { name, location } of eventParameters) {
|
|
14755
|
+
if (!Object.hasOwn(inputs, name))
|
|
14756
|
+
continue;
|
|
14757
|
+
const bucket = byLocation.get(location ?? "") ?? "eventParameters";
|
|
14758
|
+
buckets[bucket][name] = inputs[name];
|
|
14759
|
+
}
|
|
14760
|
+
return Object.fromEntries(Object.entries(buckets).filter(([, v]) => Object.keys(v).length > 0));
|
|
14761
|
+
}
|
|
14762
|
+
function buildTriggerStub(args) {
|
|
14763
|
+
const { activity, enrichment, connectionId, instanceNumber } = args;
|
|
14764
|
+
const inputs = args.inputs ?? {};
|
|
14765
|
+
const config = {
|
|
14766
|
+
...args.config,
|
|
14767
|
+
eventMode: args.config.eventMode ?? enrichment?.eventMode ?? null
|
|
14768
|
+
};
|
|
14769
|
+
const exportBucketKey = deriveExportBucketKey(config.objectName, instanceNumber);
|
|
14770
|
+
const slotKey = args.slotKey ?? deriveTriggerSlotKey(activity.displayName, instanceNumber);
|
|
14771
|
+
const eventParameters = enrichment?.eventParameters ?? [];
|
|
14772
|
+
const filterExpression = buildMandatoryFilterExpression(eventParameters, inputs);
|
|
14773
|
+
const withClause = {
|
|
14774
|
+
connector: config.connectorKey,
|
|
14775
|
+
connectionId: connectionId ?? CONNECTION_PLACEHOLDER,
|
|
14776
|
+
connectionResourceId: connectionId ?? CONNECTION_PLACEHOLDER,
|
|
14777
|
+
...bucketTriggerInputs(eventParameters, inputs),
|
|
14778
|
+
objectName: config.objectName,
|
|
14779
|
+
eventType: config.eventOperation ?? "",
|
|
14780
|
+
...config.eventMode ? { eventMode: config.eventMode } : {},
|
|
14781
|
+
...filterExpression ? { filterExpression } : {}
|
|
14782
|
+
};
|
|
14783
|
+
return {
|
|
14784
|
+
kind: "IntSvcEvent",
|
|
14785
|
+
slotKey,
|
|
14786
|
+
exportBucketKey,
|
|
14787
|
+
activity: {
|
|
14788
|
+
[slotKey]: {
|
|
14789
|
+
call: INTSVC_EVENT_CALL,
|
|
14790
|
+
with: withClause,
|
|
14791
|
+
export: {
|
|
14792
|
+
as: `{ ...$context, outputs: { ...$context?.outputs, "${exportBucketKey}": $output } }`
|
|
14793
|
+
},
|
|
14794
|
+
metadata: {
|
|
14795
|
+
activityType: "Connector",
|
|
14796
|
+
fullName: "Connector",
|
|
14797
|
+
displayName: activity.displayName,
|
|
14798
|
+
uiPathActivityTypeId: activity.uiPathActivityTypeId,
|
|
14799
|
+
configuration: buildTriggerEssentialConfiguration(config)
|
|
14800
|
+
}
|
|
14801
|
+
}
|
|
14802
|
+
}
|
|
14803
|
+
};
|
|
14804
|
+
}
|
|
14092
14805
|
function deriveExportBucketKey(objectName, instanceNumber) {
|
|
14093
14806
|
const sanitized = objectName.replace(/[^a-zA-Z0-9]/g, "_");
|
|
14094
14807
|
return `${sanitized}_${instanceNumber}`;
|
|
@@ -14229,12 +14942,23 @@ async function stubActivity(args) {
|
|
|
14229
14942
|
}
|
|
14230
14943
|
const { activity, config } = found;
|
|
14231
14944
|
const activityType = config.activityType || "Curated";
|
|
14945
|
+
if (!config.connectorKey) {
|
|
14946
|
+
return {
|
|
14947
|
+
ok: false,
|
|
14948
|
+
code: "Unsupported",
|
|
14949
|
+
message: `'${args.activityTypeId}' names no connector in its TypeCache configuration`,
|
|
14950
|
+
instructions: "Only connector activities and connector-event triggers can be stubbed. Pick one via 'uip api-workflow registry resolve <keyword>'."
|
|
14951
|
+
};
|
|
14952
|
+
}
|
|
14953
|
+
if (isTriggerActivityType(activityType)) {
|
|
14954
|
+
return stubTrigger(activity, config, args);
|
|
14955
|
+
}
|
|
14232
14956
|
if (activityType !== "Curated" && activityType !== "Generic") {
|
|
14233
14957
|
return {
|
|
14234
14958
|
ok: false,
|
|
14235
14959
|
code: "Unsupported",
|
|
14236
14960
|
message: `Activity type '${config.activityType}' is not supported`,
|
|
14237
|
-
instructions: "Only 'Curated' and '
|
|
14961
|
+
instructions: "Only 'Curated', 'Generic', 'CuratedTrigger' and 'GenericTrigger' activities are supported."
|
|
14238
14962
|
};
|
|
14239
14963
|
}
|
|
14240
14964
|
const warnings = [];
|
|
@@ -14255,7 +14979,9 @@ async function stubActivity(args) {
|
|
|
14255
14979
|
objectName: genericTarget?.objectName ?? config.objectName,
|
|
14256
14980
|
httpMethod: config.httpMethod,
|
|
14257
14981
|
connectionId: args.connectionId,
|
|
14258
|
-
operation: genericTarget?.operation
|
|
14982
|
+
operation: genericTarget?.operation,
|
|
14983
|
+
inputs: args.inputs,
|
|
14984
|
+
warnings
|
|
14259
14985
|
});
|
|
14260
14986
|
const resolvedVerb = enrichment?.httpMethod;
|
|
14261
14987
|
if (genericTarget && !resolvedVerb) {
|
|
@@ -14316,9 +15042,87 @@ async function stubActivity(args) {
|
|
|
14316
15042
|
warnings
|
|
14317
15043
|
};
|
|
14318
15044
|
}
|
|
15045
|
+
async function stubTrigger(activity, config, options) {
|
|
15046
|
+
const warnings = [];
|
|
15047
|
+
const isGeneric = config.activityType === "GenericTrigger";
|
|
15048
|
+
const eventOperation = config.eventOperation;
|
|
15049
|
+
if (!eventOperation) {
|
|
15050
|
+
return {
|
|
15051
|
+
ok: false,
|
|
15052
|
+
code: "MetadataUnavailable",
|
|
15053
|
+
message: `Trigger '${activity.uiPathActivityTypeId}' has no eventOperation in its TypeCache configuration`,
|
|
15054
|
+
instructions: "Re-run 'uip api-workflow registry resolve <keyword> --kind trigger' and pick a trigger that reports an EventOperation."
|
|
15055
|
+
};
|
|
15056
|
+
}
|
|
15057
|
+
if (!isGeneric && options.objectName !== undefined) {
|
|
15058
|
+
warnings.push("--object-name is ignored for CuratedTrigger; the object is fixed by the trigger definition.");
|
|
15059
|
+
}
|
|
15060
|
+
const objectName = isGeneric ? options.objectName?.trim() || config.objectName : config.objectName;
|
|
15061
|
+
if (!objectName) {
|
|
15062
|
+
return {
|
|
15063
|
+
ok: false,
|
|
15064
|
+
code: "MissingObject",
|
|
15065
|
+
message: `Trigger '${activity.displayName}' is a GenericTrigger and needs an object name`,
|
|
15066
|
+
instructions: `Pass --object-name <name>. List the objects this event supports with 'uip is triggers objects ${config.connectorKey} ${eventOperation} --output json'.`
|
|
15067
|
+
};
|
|
15068
|
+
}
|
|
15069
|
+
const effectiveConfig = { ...config, objectName };
|
|
15070
|
+
if (options.resourceSelections !== undefined) {
|
|
15071
|
+
warnings.push("--resource-key is ignored for triggers; event parameters are not Solution-resource pickers.");
|
|
15072
|
+
}
|
|
15073
|
+
const enrichment = await fetchTriggerEnrichment({
|
|
15074
|
+
connectorKey: config.connectorKey,
|
|
15075
|
+
eventOperation,
|
|
15076
|
+
objectName,
|
|
15077
|
+
connectionId: options.connectionId
|
|
15078
|
+
});
|
|
15079
|
+
const stub = buildTriggerStub({
|
|
15080
|
+
activity,
|
|
15081
|
+
config: effectiveConfig,
|
|
15082
|
+
enrichment,
|
|
15083
|
+
connectionId: options.connectionId,
|
|
15084
|
+
instanceNumber: options.instanceNumber,
|
|
15085
|
+
slotKey: options.slotKey,
|
|
15086
|
+
inputs: options.inputs
|
|
15087
|
+
});
|
|
15088
|
+
if (!enrichment) {
|
|
15089
|
+
warnings.push(`IS trigger metadata could not be fetched; the stub has no event parameters and no filter expression. Verify with 'uip is triggers describe ${config.connectorKey} ${eventOperation} ${objectName}'.`);
|
|
15090
|
+
}
|
|
15091
|
+
if (!options.connectionId) {
|
|
15092
|
+
warnings.push("No --connection-id provided. The stub contains a placeholder; replace it with a pinged connection UUID before running.");
|
|
15093
|
+
}
|
|
15094
|
+
const provided = new Set(Object.keys(options.inputs ?? {}));
|
|
15095
|
+
const missingRequired = (enrichment?.eventParameters ?? []).filter((p) => p.required && !provided.has(p.name)).map((p) => p.name);
|
|
15096
|
+
if (missingRequired.length > 0) {
|
|
15097
|
+
warnings.push(`Required event parameter(s) not provided via --inputs: ${missingRequired.join(", ")}. The subscription will not scope correctly — re-stub with --inputs.`);
|
|
15098
|
+
}
|
|
15099
|
+
const known = new Set((enrichment?.eventParameters ?? []).map((p) => p.name));
|
|
15100
|
+
const unknownInputs = [...provided].filter((name) => !known.has(name));
|
|
15101
|
+
if (enrichment && unknownInputs.length > 0) {
|
|
15102
|
+
warnings.push(`--inputs key(s) not recognized as event parameters and therefore dropped: ${unknownInputs.join(", ")}. Check Data.EventParameters.`);
|
|
15103
|
+
}
|
|
15104
|
+
const eventMode = config.eventMode ?? enrichment?.eventMode;
|
|
15105
|
+
if (eventMode === "webhooks") {
|
|
15106
|
+
warnings.push("eventMode is 'webhooks': this trigger cannot be debugged locally. 'uip api-workflow run' only replays real events for polling triggers; pass --input-arguments to exercise the rest of the workflow with a simulated payload.");
|
|
15107
|
+
}
|
|
15108
|
+
return {
|
|
15109
|
+
ok: true,
|
|
15110
|
+
kind: stub.kind,
|
|
15111
|
+
slotKey: stub.slotKey,
|
|
15112
|
+
exportBucketKey: stub.exportBucketKey,
|
|
15113
|
+
activity: stub.activity,
|
|
15114
|
+
parameters: [],
|
|
15115
|
+
requestFields: [],
|
|
15116
|
+
responseFields: enrichment?.outputFields ?? [],
|
|
15117
|
+
solutionResourceFields: [],
|
|
15118
|
+
eventParameters: enrichment?.eventParameters ?? [],
|
|
15119
|
+
filterFields: enrichment?.filterFields ?? [],
|
|
15120
|
+
isEnrichmentAvailable: enrichment !== null,
|
|
15121
|
+
warnings
|
|
15122
|
+
};
|
|
15123
|
+
}
|
|
14319
15124
|
|
|
14320
15125
|
// src/services/bindings-service.ts
|
|
14321
|
-
var INTSVC_CALL = "UiPath.IntSvc";
|
|
14322
15126
|
var IMPLICIT_CONNECTION = "ImplicitConnection";
|
|
14323
15127
|
var BINDINGS_FILE_NAME = "bindings_v2.json";
|
|
14324
15128
|
var BINDINGS_VERSION = "2.0";
|
|
@@ -14331,56 +15135,31 @@ var LOCATION_TO_BUCKET = {
|
|
|
14331
15135
|
};
|
|
14332
15136
|
function extractIntSvcActivities(workflow) {
|
|
14333
15137
|
const found = [];
|
|
14334
|
-
|
|
14335
|
-
|
|
14336
|
-
}
|
|
14337
|
-
function visit(node, found) {
|
|
14338
|
-
if (Array.isArray(node)) {
|
|
14339
|
-
for (const item of node)
|
|
14340
|
-
visit(item, found);
|
|
14341
|
-
return;
|
|
14342
|
-
}
|
|
14343
|
-
if (node === null || typeof node !== "object") {
|
|
14344
|
-
return;
|
|
14345
|
-
}
|
|
14346
|
-
for (const [key, value] of Object.entries(node)) {
|
|
14347
|
-
if (isIntSvcActivity(value)) {
|
|
14348
|
-
found.push({
|
|
14349
|
-
slotKey: key,
|
|
14350
|
-
activity: value
|
|
14351
|
-
});
|
|
15138
|
+
walkTasks(workflow, "", (slotKey, value) => {
|
|
15139
|
+
if (isRecord(value) && (value.call === INTSVC_CALL || value.call === INTSVC_EVENT_CALL)) {
|
|
15140
|
+
found.push({ slotKey, activity: value });
|
|
14352
15141
|
}
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
}
|
|
14356
|
-
function isIntSvcActivity(value) {
|
|
14357
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
14358
|
-
return false;
|
|
14359
|
-
}
|
|
14360
|
-
return value.call === INTSVC_CALL;
|
|
15142
|
+
});
|
|
15143
|
+
return found;
|
|
14361
15144
|
}
|
|
14362
15145
|
function buildBinding(node) {
|
|
14363
|
-
const
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
const
|
|
14368
|
-
const
|
|
14369
|
-
if (
|
|
14370
|
-
return null;
|
|
14371
|
-
}
|
|
14372
|
-
if (connectionId === IMPLICIT_CONNECTION) {
|
|
14373
|
-
return null;
|
|
14374
|
-
}
|
|
14375
|
-
const connector = withClause.connector;
|
|
14376
|
-
if (typeof connector !== "string" || connector.length === 0) {
|
|
15146
|
+
const identity = readBindingIdentity(node);
|
|
15147
|
+
return identity && connectionShapedBinding("Connection", node, identity, {});
|
|
15148
|
+
}
|
|
15149
|
+
function buildEventTriggerBinding(node, essential = readEssential(node)) {
|
|
15150
|
+
const identity = readBindingIdentity(node, instanceParametersOf(essential)?.connectorKey);
|
|
15151
|
+
const event = readTriggerEvent(node, essential);
|
|
15152
|
+
if (identity === null || event === null)
|
|
14377
15153
|
return null;
|
|
14378
|
-
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
|
|
15154
|
+
return connectionShapedBinding("EventTrigger", node, identity, {
|
|
15155
|
+
ObjectName: event.objectName,
|
|
15156
|
+
Operation: event.operation,
|
|
15157
|
+
FilterExpression: firstString(withOf(node).filterExpression) ?? ""
|
|
15158
|
+
});
|
|
15159
|
+
}
|
|
15160
|
+
function connectionShapedBinding(resource, node, { connectionId, connector, displayName }, extraMetadata) {
|
|
14382
15161
|
return {
|
|
14383
|
-
resource
|
|
15162
|
+
resource,
|
|
14384
15163
|
key: connectionId,
|
|
14385
15164
|
activityId: node.slotKey,
|
|
14386
15165
|
activityDisplayName: displayName,
|
|
@@ -14395,19 +15174,105 @@ function buildBinding(node) {
|
|
|
14395
15174
|
Connector: connector,
|
|
14396
15175
|
ActivityName: displayName,
|
|
14397
15176
|
BindingsVersion: BINDINGS_RESOURCE_BINDINGS_VERSION,
|
|
15177
|
+
...extraMetadata,
|
|
14398
15178
|
SolutionsSupport: "true"
|
|
14399
15179
|
}
|
|
14400
15180
|
};
|
|
14401
15181
|
}
|
|
15182
|
+
function buildTriggerPropertyBinding(node, trigger, subBindingNames) {
|
|
15183
|
+
const withClause = withOf(node);
|
|
15184
|
+
const value = {};
|
|
15185
|
+
const add = (name, raw) => {
|
|
15186
|
+
if (raw === null || raw === undefined || raw === "")
|
|
15187
|
+
return;
|
|
15188
|
+
value[name] = { defaultValue: String(raw), isExpression: false };
|
|
15189
|
+
};
|
|
15190
|
+
for (const bucket of ["pathParameters", "queryParameters"]) {
|
|
15191
|
+
const entries = withClause[bucket];
|
|
15192
|
+
if (!isRecord(entries))
|
|
15193
|
+
continue;
|
|
15194
|
+
for (const [name, raw] of Object.entries(entries))
|
|
15195
|
+
add(name, raw);
|
|
15196
|
+
}
|
|
15197
|
+
const eventParameters = withClause.eventParameters;
|
|
15198
|
+
if (isRecord(eventParameters)) {
|
|
15199
|
+
for (const [name, raw] of Object.entries(eventParameters)) {
|
|
15200
|
+
if (subBindingNames?.has(name))
|
|
15201
|
+
add(name, raw);
|
|
15202
|
+
}
|
|
15203
|
+
}
|
|
15204
|
+
const names = Object.keys(value).join(",");
|
|
15205
|
+
if (names.length === 0)
|
|
15206
|
+
return null;
|
|
15207
|
+
return {
|
|
15208
|
+
resource: "Property",
|
|
15209
|
+
key: trigger.metadata.Operation,
|
|
15210
|
+
value,
|
|
15211
|
+
activityDisplayName: trigger.activityDisplayName,
|
|
15212
|
+
metadata: {
|
|
15213
|
+
ActivityName: trigger.activityDisplayName,
|
|
15214
|
+
BindingsVersion: BINDINGS_RESOURCE_BINDINGS_VERSION,
|
|
15215
|
+
ObjectName: trigger.metadata.ObjectName,
|
|
15216
|
+
Operation: trigger.metadata.Operation,
|
|
15217
|
+
ParentResourceKey: `EventTrigger.${trigger.key}`,
|
|
15218
|
+
TriggerCreateParameters: names,
|
|
15219
|
+
DebugQueryParameters: names
|
|
15220
|
+
}
|
|
15221
|
+
};
|
|
15222
|
+
}
|
|
15223
|
+
function readTriggerEvent(node, essential) {
|
|
15224
|
+
const withClause = withOf(node);
|
|
15225
|
+
const instanceParameters = instanceParametersOf(essential);
|
|
15226
|
+
const objectName = firstString(withClause.objectName, instanceParameters?.objectName, essential?.objectName);
|
|
15227
|
+
const operation = firstString(withClause.eventType, instanceParameters?.eventOperation);
|
|
15228
|
+
return objectName === null || operation === null ? null : { objectName, operation };
|
|
15229
|
+
}
|
|
15230
|
+
function readBindingIdentity(node, connectorFallback) {
|
|
15231
|
+
const withClause = withOf(node);
|
|
15232
|
+
const connectionId = readConnectionId(withClause);
|
|
15233
|
+
if (connectionId === null || connectionId === IMPLICIT_CONNECTION || connectionId.includes(PLACEHOLDER_MARKER)) {
|
|
15234
|
+
return null;
|
|
15235
|
+
}
|
|
15236
|
+
const connector = firstString(withClause.connector, connectorFallback);
|
|
15237
|
+
if (connector === null)
|
|
15238
|
+
return null;
|
|
15239
|
+
return { connectionId, connector, displayName: readDisplayName(node) };
|
|
15240
|
+
}
|
|
15241
|
+
function readDisplayName(node) {
|
|
15242
|
+
const metadata = node.activity.metadata;
|
|
15243
|
+
return typeof metadata?.displayName === "string" ? metadata.displayName : node.slotKey;
|
|
15244
|
+
}
|
|
15245
|
+
function firstString(...candidates) {
|
|
15246
|
+
for (const candidate of candidates) {
|
|
15247
|
+
if (typeof candidate === "string" && candidate.length > 0) {
|
|
15248
|
+
return candidate;
|
|
15249
|
+
}
|
|
15250
|
+
}
|
|
15251
|
+
return null;
|
|
15252
|
+
}
|
|
15253
|
+
function readConnectionId(withClause) {
|
|
15254
|
+
return firstString(withClause.connectionResourceId, withClause.connectionId);
|
|
15255
|
+
}
|
|
15256
|
+
function withOf(node) {
|
|
15257
|
+
return isRecord(node.activity.with) ? node.activity.with : {};
|
|
15258
|
+
}
|
|
15259
|
+
function readEssential(node) {
|
|
15260
|
+
const metadata = node.activity.metadata;
|
|
15261
|
+
return readEssentialConfiguration(metadata?.configuration, (error) => logger.warn(`Could not parse metadata.configuration for activity '${node.slotKey}': ${error.message}`));
|
|
15262
|
+
}
|
|
15263
|
+
function instanceParametersOf(essential) {
|
|
15264
|
+
const instanceParameters = essential?.instanceParameters;
|
|
15265
|
+
return isRecord(instanceParameters) ? instanceParameters : undefined;
|
|
15266
|
+
}
|
|
14402
15267
|
async function buildResourceBindings(node) {
|
|
14403
15268
|
const withClause = node.activity.with;
|
|
14404
15269
|
if (!withClause)
|
|
14405
15270
|
return [];
|
|
14406
|
-
const essential = parseEssentialConfiguration(node
|
|
15271
|
+
const essential = parseEssentialConfiguration(node);
|
|
14407
15272
|
if (!essential?.connectorKey || !essential.objectName)
|
|
14408
15273
|
return [];
|
|
14409
|
-
const rawConnectionId = withClause
|
|
14410
|
-
const connectionId =
|
|
15274
|
+
const rawConnectionId = readConnectionId(withClause);
|
|
15275
|
+
const connectionId = rawConnectionId !== null && rawConnectionId !== IMPLICIT_CONNECTION ? rawConnectionId : undefined;
|
|
14411
15276
|
const enrichment = await fetchIsEnrichment({
|
|
14412
15277
|
connectorKey: essential.connectorKey,
|
|
14413
15278
|
objectName: essential.objectName,
|
|
@@ -14417,8 +15282,7 @@ async function buildResourceBindings(node) {
|
|
|
14417
15282
|
});
|
|
14418
15283
|
if (!enrichment)
|
|
14419
15284
|
return [];
|
|
14420
|
-
const
|
|
14421
|
-
const displayName = typeof metadata?.displayName === "string" ? metadata.displayName : node.slotKey;
|
|
15285
|
+
const displayName = readDisplayName(node);
|
|
14422
15286
|
const bindings = [];
|
|
14423
15287
|
for (const field of enrichment.solutionResourceFields) {
|
|
14424
15288
|
const bucket = LOCATION_TO_BUCKET[field.location] ?? "bodyParameters";
|
|
@@ -14448,15 +15312,8 @@ async function buildResourceBindings(node) {
|
|
|
14448
15312
|
}
|
|
14449
15313
|
return bindings;
|
|
14450
15314
|
}
|
|
14451
|
-
function parseEssentialConfiguration(
|
|
14452
|
-
const
|
|
14453
|
-
const raw = metadata?.configuration;
|
|
14454
|
-
if (typeof raw !== "string")
|
|
14455
|
-
return null;
|
|
14456
|
-
const [parseError, parsed] = catchError(() => JSON.parse(raw));
|
|
14457
|
-
if (parseError)
|
|
14458
|
-
return null;
|
|
14459
|
-
const essential = parsed.essentialConfiguration;
|
|
15315
|
+
function parseEssentialConfiguration(node) {
|
|
15316
|
+
const essential = readEssential(node);
|
|
14460
15317
|
if (!essential)
|
|
14461
15318
|
return null;
|
|
14462
15319
|
const instanceParameters = essential.instanceParameters;
|
|
@@ -14468,17 +15325,84 @@ function parseEssentialConfiguration(activity) {
|
|
|
14468
15325
|
activityType: typeof instanceParameters?.activityType === "string" ? instanceParameters.activityType : undefined
|
|
14469
15326
|
};
|
|
14470
15327
|
}
|
|
15328
|
+
var PLACEHOLDER_MARKER = "REPLACE_WITH";
|
|
15329
|
+
function placeholderConnectionId(node) {
|
|
15330
|
+
const connectionId = readConnectionId(withOf(node));
|
|
15331
|
+
return connectionId?.includes(PLACEHOLDER_MARKER) ? connectionId : null;
|
|
15332
|
+
}
|
|
15333
|
+
function missingTriggerWarning(node, essential) {
|
|
15334
|
+
const placeholder = placeholderConnectionId(node);
|
|
15335
|
+
const [problem, fix] = placeholder !== null ? [
|
|
15336
|
+
`uses the placeholder connection '${placeholder}'`,
|
|
15337
|
+
"Re-stub it with --connection-id <pinged UUID> and re-run 'bindings sync'"
|
|
15338
|
+
] : readTriggerEvent(node, essential) === null ? [
|
|
15339
|
+
"names no event (with.objectName / with.eventType)",
|
|
15340
|
+
"Re-stub the trigger and re-run 'bindings sync'"
|
|
15341
|
+
] : [
|
|
15342
|
+
"names no usable connection (with.connectionId / with.connector)",
|
|
15343
|
+
"Set the connection and re-run 'bindings sync'"
|
|
15344
|
+
];
|
|
15345
|
+
return `Start trigger '${node.slotKey}' ${problem}; no EventTrigger binding was written and any stored one was dropped. ${fix}, or the deployed process will never fire.`;
|
|
15346
|
+
}
|
|
15347
|
+
async function fetchSubBindingNames(node, trigger) {
|
|
15348
|
+
const eventParameters = withOf(node).eventParameters;
|
|
15349
|
+
if (!isRecord(eventParameters) || Object.keys(eventParameters).length === 0) {
|
|
15350
|
+
return new Set;
|
|
15351
|
+
}
|
|
15352
|
+
const enrichment = await fetchTriggerEnrichment({
|
|
15353
|
+
connectorKey: trigger.metadata.Connector,
|
|
15354
|
+
eventOperation: trigger.metadata.Operation,
|
|
15355
|
+
objectName: trigger.metadata.ObjectName,
|
|
15356
|
+
connectionId: trigger.key
|
|
15357
|
+
});
|
|
15358
|
+
return enrichment && new Set(enrichment.eventParameters.filter((p) => p.subBinding === true).map((p) => p.name));
|
|
15359
|
+
}
|
|
15360
|
+
async function buildTriggerBindings(node, triggerSlot, warn) {
|
|
15361
|
+
if (node.activity !== triggerSlot) {
|
|
15362
|
+
warn(`Start trigger '${node.slotKey}' is not the first activity after 'WorkflowStart' in the root Sequence; no EventTrigger binding was written for it. 'uip api-workflow validate' reports this as an error.`);
|
|
15363
|
+
return [];
|
|
15364
|
+
}
|
|
15365
|
+
const essential = readEssential(node);
|
|
15366
|
+
const trigger = buildEventTriggerBinding(node, essential);
|
|
15367
|
+
if (trigger === null) {
|
|
15368
|
+
warn(missingTriggerWarning(node, essential));
|
|
15369
|
+
return [];
|
|
15370
|
+
}
|
|
15371
|
+
const subBindingNames = await fetchSubBindingNames(node, trigger);
|
|
15372
|
+
if (subBindingNames === null) {
|
|
15373
|
+
warn(`Could not read trigger metadata for '${node.slotKey}', so event parameters IS exposes as sub-bindings were left out of its Property binding. Check the connection and re-run 'bindings sync'.`);
|
|
15374
|
+
}
|
|
15375
|
+
const property = buildTriggerPropertyBinding(node, trigger, subBindingNames);
|
|
15376
|
+
return property === null ? [trigger] : [trigger, property];
|
|
15377
|
+
}
|
|
14471
15378
|
async function buildBindingsFile(workflow) {
|
|
14472
15379
|
const activities = extractIntSvcActivities(workflow);
|
|
14473
15380
|
const byKey = new Map;
|
|
15381
|
+
const triggerBindings = [];
|
|
14474
15382
|
const resourcesByKey = new Map;
|
|
15383
|
+
const warnings = [];
|
|
14475
15384
|
let intSvcCount = 0;
|
|
15385
|
+
const warn = (warning) => {
|
|
15386
|
+
warnings.push(warning);
|
|
15387
|
+
logger.warn(warning);
|
|
15388
|
+
};
|
|
15389
|
+
const triggerSlot = startTriggerSlot(workflow);
|
|
14476
15390
|
for (const node of activities) {
|
|
15391
|
+
if (isStartTriggerTask(node.activity)) {
|
|
15392
|
+
triggerBindings.push(...await buildTriggerBindings(node, triggerSlot, warn));
|
|
15393
|
+
continue;
|
|
15394
|
+
}
|
|
15395
|
+
const placeholder = placeholderConnectionId(node);
|
|
15396
|
+
if (placeholder !== null) {
|
|
15397
|
+
warn(`Activity '${node.slotKey}' uses the placeholder connection '${placeholder}'; no Connection binding was written. Re-stub it with --connection-id <pinged UUID> and re-run 'bindings sync'.`);
|
|
15398
|
+
}
|
|
14477
15399
|
const binding = buildBinding(node);
|
|
14478
15400
|
if (binding != null) {
|
|
14479
15401
|
intSvcCount += 1;
|
|
14480
15402
|
byKey.set(`${binding.resource}:${binding.key}`, binding);
|
|
14481
15403
|
}
|
|
15404
|
+
if (node.activity.call === INTSVC_EVENT_CALL)
|
|
15405
|
+
continue;
|
|
14482
15406
|
const [resourceError, resourceBindings] = await catchError(buildResourceBindings(node));
|
|
14483
15407
|
if (resourceError) {
|
|
14484
15408
|
logger.warn(`Could not derive resource bindings for activity '${node.slotKey}': ${resourceError.message}`);
|
|
@@ -14491,12 +15415,18 @@ async function buildBindingsFile(workflow) {
|
|
|
14491
15415
|
return {
|
|
14492
15416
|
bindingsFile: {
|
|
14493
15417
|
version: BINDINGS_VERSION,
|
|
14494
|
-
resources: [
|
|
15418
|
+
resources: [
|
|
15419
|
+
...byKey.values(),
|
|
15420
|
+
...triggerBindings,
|
|
15421
|
+
...resourcesByKey.values()
|
|
15422
|
+
]
|
|
14495
15423
|
},
|
|
14496
15424
|
visited: activities.length,
|
|
14497
15425
|
intSvcCount,
|
|
14498
15426
|
deduplicated: intSvcCount - byKey.size,
|
|
14499
|
-
|
|
15427
|
+
eventTriggers: triggerBindings.filter((r) => r.resource === "EventTrigger").length,
|
|
15428
|
+
resourceBindings: resourcesByKey.size,
|
|
15429
|
+
warnings
|
|
14500
15430
|
};
|
|
14501
15431
|
}
|
|
14502
15432
|
async function syncBindings(options) {
|
|
@@ -14530,7 +15460,9 @@ async function syncBindings(options) {
|
|
|
14530
15460
|
visited,
|
|
14531
15461
|
intSvcCount,
|
|
14532
15462
|
deduplicated,
|
|
14533
|
-
|
|
15463
|
+
eventTriggers,
|
|
15464
|
+
resourceBindings,
|
|
15465
|
+
warnings
|
|
14534
15466
|
} = await buildBindingsFile(workflow);
|
|
14535
15467
|
const bindingsPath = fs.path.join(fs.path.dirname(resolvedWorkflow), BINDINGS_FILE_NAME);
|
|
14536
15468
|
const preserved = await readPreservableEntries(bindingsPath, bindingsFile);
|
|
@@ -14552,8 +15484,10 @@ async function syncBindings(options) {
|
|
|
14552
15484
|
visitedActivities: visited,
|
|
14553
15485
|
intSvcActivities: intSvcCount,
|
|
14554
15486
|
deduplicatedConnections: deduplicated,
|
|
15487
|
+
eventTriggers,
|
|
14555
15488
|
resourceBindings,
|
|
14556
|
-
preservedResources: preserved.length
|
|
15489
|
+
preservedResources: preserved.length,
|
|
15490
|
+
warnings
|
|
14557
15491
|
};
|
|
14558
15492
|
}
|
|
14559
15493
|
async function readPreservableEntries(bindingsPath, generated) {
|
|
@@ -14568,9 +15502,14 @@ async function readPreservableEntries(bindingsPath, generated) {
|
|
|
14568
15502
|
return [];
|
|
14569
15503
|
const generatedIds = new Set(generated.resources.map(resourceIdentity));
|
|
14570
15504
|
return existing.resources.filter((r) => {
|
|
14571
|
-
const
|
|
14572
|
-
|
|
15505
|
+
const entry = r;
|
|
15506
|
+
const kind = entry.resource;
|
|
15507
|
+
if (kind === "Connection" || kind === "EventTrigger")
|
|
14573
15508
|
return false;
|
|
15509
|
+
const parent = isRecord(entry.metadata) ? entry.metadata.ParentResourceKey : undefined;
|
|
15510
|
+
if (kind === "Property" && typeof parent === "string" && parent.startsWith("EventTrigger.")) {
|
|
15511
|
+
return false;
|
|
15512
|
+
}
|
|
14574
15513
|
return !generatedIds.has(resourceIdentity(r));
|
|
14575
15514
|
});
|
|
14576
15515
|
}
|
|
@@ -14589,6 +15528,11 @@ command does the same translation offline: walks the workflow, extracts IntSvc
|
|
|
14589
15528
|
connector activities (skipping Http-kind / 'ImplicitConnection'), dedupes by
|
|
14590
15529
|
connection UUID, and writes 'bindings_v2.json' next to the workflow.
|
|
14591
15530
|
|
|
15531
|
+
A 'UiPath.IntSvcEvent' trigger activity yields an 'EventTrigger' binding (plus a
|
|
15532
|
+
'Property' binding for its path/query event parameters), which is what makes the
|
|
15533
|
+
deployed process trigger-driven. Both are regenerated on every sync so an edit
|
|
15534
|
+
to the object, event, filter or connection reaches the binding.
|
|
15535
|
+
|
|
14592
15536
|
The output is consumed by 'uip solution resources refresh', which uses
|
|
14593
15537
|
@uipath/resource-builder-sdk to populate the Solution resource catalogue
|
|
14594
15538
|
(resources/...*.json) and the per-user debug overwrites
|
|
@@ -14626,8 +15570,10 @@ Subcommands:
|
|
|
14626
15570
|
ActivitiesVisited: result.visitedActivities,
|
|
14627
15571
|
IntSvcActivities: result.intSvcActivities,
|
|
14628
15572
|
DuplicatesCollapsed: result.deduplicatedConnections,
|
|
15573
|
+
EventTriggers: result.eventTriggers,
|
|
14629
15574
|
ResourceBindings: result.resourceBindings,
|
|
14630
|
-
PreservedResources: result.preservedResources
|
|
15575
|
+
PreservedResources: result.preservedResources,
|
|
15576
|
+
Warnings: result.warnings.length > 0 ? result.warnings : undefined
|
|
14631
15577
|
}
|
|
14632
15578
|
});
|
|
14633
15579
|
});
|
|
@@ -14636,7 +15582,7 @@ Subcommands:
|
|
|
14636
15582
|
// src/commands/packager-shared.ts
|
|
14637
15583
|
async function createPackager() {
|
|
14638
15584
|
registerPackagerFactories();
|
|
14639
|
-
const { createNodeProjectPackager } = await import("./node-
|
|
15585
|
+
const { createNodeProjectPackager } = await import("./node-yh8xgmtz.js");
|
|
14640
15586
|
return await createNodeProjectPackager({
|
|
14641
15587
|
logHandler: logger.handleLog
|
|
14642
15588
|
});
|
|
@@ -14659,7 +15605,7 @@ async function setupProject(packager, projectPath) {
|
|
|
14659
15605
|
return packager.setupAsync(absPath);
|
|
14660
15606
|
}
|
|
14661
15607
|
async function buildBaseOptions() {
|
|
14662
|
-
const { ProjectPackOptions } = await import("./index-
|
|
15608
|
+
const { ProjectPackOptions } = await import("./index-qffm5md9.js");
|
|
14663
15609
|
const sdkLogLevelMap = {
|
|
14664
15610
|
[0 /* DEBUG */]: "Debug" /* Debug */,
|
|
14665
15611
|
[1 /* INFO */]: "Information" /* Info */,
|
|
@@ -14956,7 +15902,7 @@ var package_default3 = {
|
|
|
14956
15902
|
name: "@uipath/solution-sdk",
|
|
14957
15903
|
author: "UiPath",
|
|
14958
15904
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
14959
|
-
version: "1.
|
|
15905
|
+
version: "1.205.0-preview.258",
|
|
14960
15906
|
repository: {
|
|
14961
15907
|
type: "git",
|
|
14962
15908
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -14985,6 +15931,14 @@ var package_default3 = {
|
|
|
14985
15931
|
"./auth": {
|
|
14986
15932
|
types: "./dist/src/solution-auth.d.ts",
|
|
14987
15933
|
default: "./dist/solution-auth.js"
|
|
15934
|
+
},
|
|
15935
|
+
"./deployments": {
|
|
15936
|
+
types: "./dist/src/deployment-search.d.ts",
|
|
15937
|
+
default: "./dist/deployment-search.js"
|
|
15938
|
+
},
|
|
15939
|
+
"./packages": {
|
|
15940
|
+
types: "./dist/src/package-search.d.ts",
|
|
15941
|
+
default: "./dist/package-search.js"
|
|
14988
15942
|
}
|
|
14989
15943
|
},
|
|
14990
15944
|
bin: {
|
|
@@ -14995,7 +15949,7 @@ var package_default3 = {
|
|
|
14995
15949
|
],
|
|
14996
15950
|
private: false,
|
|
14997
15951
|
scripts: {
|
|
14998
|
-
build: "bun build ./src/index.ts ./src/resources/index.ts ./src/solution-auth.ts --outdir dist --format esm --target node --splitting --sourcemap=linked && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
15952
|
+
build: "bun build ./src/index.ts ./src/resources/index.ts ./src/solution-auth.ts ./src/deployment-search.ts ./src/package-search.ts --outdir dist --format esm --target node --splitting --sourcemap=linked && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
14999
15953
|
generate: "bun run src/scripts/generate-sdk.ts",
|
|
15000
15954
|
lint: "biome check .",
|
|
15001
15955
|
test: "vitest run",
|
|
@@ -15007,7 +15961,8 @@ var package_default3 = {
|
|
|
15007
15961
|
"@uipath/common": "workspace:*",
|
|
15008
15962
|
"@uipath/filesystem": "workspace:*",
|
|
15009
15963
|
"@uipath/orchestrator-sdk": "workspace:*",
|
|
15010
|
-
"@uipath/
|
|
15964
|
+
"@uipath/pipelines-sdk": "workspace:*",
|
|
15965
|
+
"@uipath/resource-builder-sdk": "2025.11.0-alpha6584-4367",
|
|
15011
15966
|
"@uipath/solutionpackager-tool-core": "workspace:*",
|
|
15012
15967
|
"@uipath/studioweb-sdk": "workspace:*",
|
|
15013
15968
|
"@types/node": "^25.5.2",
|
|
@@ -15250,7 +16205,7 @@ function normalizeProjectType(projectType) {
|
|
|
15250
16205
|
function toPortableRelativePath(relativePath) {
|
|
15251
16206
|
return relativePath.replace(/\\/g, "/");
|
|
15252
16207
|
}
|
|
15253
|
-
function
|
|
16208
|
+
function isRecord2(value) {
|
|
15254
16209
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15255
16210
|
}
|
|
15256
16211
|
async function tryRegisterProjectInParentSolution(fs, projectDir, options) {
|
|
@@ -15452,11 +16407,11 @@ async function readProjectManifest(fs, filePath, useProjectJson) {
|
|
|
15452
16407
|
null
|
|
15453
16408
|
];
|
|
15454
16409
|
}
|
|
15455
|
-
if (!
|
|
16410
|
+
if (!isRecord2(parsed)) {
|
|
15456
16411
|
return [new Error(`Invalid project file: ${filePath}`), null];
|
|
15457
16412
|
}
|
|
15458
16413
|
const designOptions = parsed.designOptions;
|
|
15459
|
-
const outputType = useProjectJson &&
|
|
16414
|
+
const outputType = useProjectJson && isRecord2(designOptions) ? readString(designOptions.outputType) : undefined;
|
|
15460
16415
|
const projectType = outputType ?? readString(parsed.ProjectType);
|
|
15461
16416
|
if (!projectType) {
|
|
15462
16417
|
return [new Error(`ProjectType not found in ${filePath}`), null];
|
|
@@ -15483,7 +16438,7 @@ async function readSolutionManifest(fs, solutionFile) {
|
|
|
15483
16438
|
null
|
|
15484
16439
|
];
|
|
15485
16440
|
}
|
|
15486
|
-
if (!
|
|
16441
|
+
if (!isRecord2(parsed)) {
|
|
15487
16442
|
return [
|
|
15488
16443
|
new Error(`Invalid solution file: ${solutionFile} must contain a JSON object.`),
|
|
15489
16444
|
null
|
|
@@ -15497,7 +16452,7 @@ async function readSolutionManifest(fs, solutionFile) {
|
|
|
15497
16452
|
}
|
|
15498
16453
|
const projects = [];
|
|
15499
16454
|
for (const [index, project] of parsed.Projects.entries()) {
|
|
15500
|
-
if (!
|
|
16455
|
+
if (!isRecord2(project)) {
|
|
15501
16456
|
return [
|
|
15502
16457
|
new Error(`Invalid solution file: Projects[${index}] must be an object.`),
|
|
15503
16458
|
null
|
|
@@ -15526,7 +16481,7 @@ function buildRegistrationSuccessInstructions(solutionDir) {
|
|
|
15526
16481
|
return [
|
|
15527
16482
|
"The project is listed in the parent solution manifest.",
|
|
15528
16483
|
"Packing or uploading the solution will sync solution resources automatically.",
|
|
15529
|
-
`To sync resources before packaging, run
|
|
16484
|
+
`To sync resources before packaging, run: uip solution resources refresh --solution-folder ${quoteForShell(solutionDir)}`
|
|
15530
16485
|
].join(`
|
|
15531
16486
|
`);
|
|
15532
16487
|
}
|
|
@@ -15565,7 +16520,8 @@ var DEFAULT_EXCLUDED_DIR_NAMES = new Set([
|
|
|
15565
16520
|
"__pycache__",
|
|
15566
16521
|
".git",
|
|
15567
16522
|
".local",
|
|
15568
|
-
".flow-sdk"
|
|
16523
|
+
".flow-sdk",
|
|
16524
|
+
".flow-debug"
|
|
15569
16525
|
]);
|
|
15570
16526
|
// ../solution-sdk/src/project-debug-status.ts
|
|
15571
16527
|
var SUCCEEDED = "creationsucceeded";
|
|
@@ -15730,7 +16686,7 @@ var PACK_EXAMPLES = [
|
|
|
15730
16686
|
}
|
|
15731
16687
|
];
|
|
15732
16688
|
var registerPackCommand = (program) => {
|
|
15733
|
-
const command = program.command("pack").description("Pack an API Workflow project into a .nupkg file").argument("<project-path>", "Path to the API Workflow project directory or .uip file").argument("<
|
|
16689
|
+
const command = program.command("pack").description("Pack an API Workflow project into a .nupkg file").argument("<project-path>", "Path to the API Workflow project directory or .uip file").argument("<output-path>", "Directory where .nupkg is written").option("--package-id <id>", "NuGet package ID").option("--package-version <version>", "NuGet package version").option("--signing-certificate-path <path>", "Path to .pfx certificate file").option("--signing-certificate-password <password>", "Certificate password").option("--signing-timestamp-server <url>", "Timestamp server URL");
|
|
15734
16690
|
registerPackageMetadataOptions(command).examples(PACK_EXAMPLES).trackedAction(processContext, async (projectPath, destinationPath, opts) => {
|
|
15735
16691
|
opts.projectPath = projectPath;
|
|
15736
16692
|
opts.destinationPath = destinationPath;
|
|
@@ -15765,6 +16721,7 @@ var registerPackCommand = (program) => {
|
|
|
15765
16721
|
};
|
|
15766
16722
|
|
|
15767
16723
|
// src/commands/registry.ts
|
|
16724
|
+
var SEARCH_KINDS = ["activity", "trigger", "all"];
|
|
15768
16725
|
function collectRepeatable(value, previous) {
|
|
15769
16726
|
return [...previous, value];
|
|
15770
16727
|
}
|
|
@@ -15783,10 +16740,17 @@ Generic activities (activityType "Generic" in resolve output) apply an operation
|
|
|
15783
16740
|
(list/create/retrieve/update/delete/...) to a connector object you choose — pass it via
|
|
15784
16741
|
--object-name. Discover objects with 'uip is resources list <connector-key> --connection-id <uuid>'.
|
|
15785
16742
|
|
|
16743
|
+
Triggers (activityType "CuratedTrigger" / "GenericTrigger", Kind "trigger") subscribe to a
|
|
16744
|
+
connector event instead of calling an operation. They stub into call: "UiPath.IntSvcEvent"
|
|
16745
|
+
and must be the workflow's FIRST activity, right after WorkflowStart. Scope the subscription
|
|
16746
|
+
with --inputs (event parameters), then run 'uip api-workflow bindings sync' so the
|
|
16747
|
+
EventTrigger binding reaches bindings_v2.json — without it the deployed process never fires.
|
|
16748
|
+
|
|
15786
16749
|
Subcommands:
|
|
15787
|
-
resolve Find candidate activities by keyword (TypeCache, projectType=Api).
|
|
16750
|
+
resolve Find candidate activities and triggers by keyword (TypeCache, projectType=Api).
|
|
15788
16751
|
stub Emit a ready-to-paste activity object for a known uiPathActivityTypeId.`);
|
|
15789
|
-
registry.command("resolve").description("Search the API-workflow-compatible TypeCache by keyword and return candidate activities.").argument("<keyword>", "Substring matched against displayName / connectorKey / objectName").option("-l, --limit <n>", "Maximum results to return (default: 50)", "50").trackedAction(processContext, async (keyword, options) => {
|
|
16752
|
+
registry.command("resolve").description("Search the API-workflow-compatible TypeCache by keyword and return candidate activities and triggers.").argument("<keyword>", "Substring matched against displayName / connectorKey / objectName / eventOperation").option("-l, --limit <n>", "Maximum results to return (default: 50)", "50").addOption(new Option("--kind <kind>", "Which catalog to search: activity | trigger | all (default: all). Triggers live in a separate TypeCache catalog and are never returned by an activity-only search.").choices(SEARCH_KINDS).default("all")).trackedAction(processContext, async (keyword, options) => {
|
|
16753
|
+
const { kind } = options;
|
|
15790
16754
|
const limit = Number.parseInt(options.limit ?? "50", 10);
|
|
15791
16755
|
if (Number.isNaN(limit) || limit < 1) {
|
|
15792
16756
|
OutputFormatter.error({
|
|
@@ -15797,7 +16761,7 @@ Subcommands:
|
|
|
15797
16761
|
processContext.exit(1);
|
|
15798
16762
|
return;
|
|
15799
16763
|
}
|
|
15800
|
-
const [error,
|
|
16764
|
+
const [error, result] = await catchError(searchActivities(keyword, limit, kind));
|
|
15801
16765
|
if (error) {
|
|
15802
16766
|
OutputFormatter.error({
|
|
15803
16767
|
Result: "Failure",
|
|
@@ -15807,11 +16771,13 @@ Subcommands:
|
|
|
15807
16771
|
processContext.exit(1);
|
|
15808
16772
|
return;
|
|
15809
16773
|
}
|
|
16774
|
+
const { matches, warnings } = result;
|
|
15810
16775
|
if (matches.length === 0) {
|
|
16776
|
+
const searched = kind === "trigger" ? "triggers" : kind === "all" && warnings.length === 0 ? "activities or triggers" : "activities";
|
|
15811
16777
|
OutputFormatter.error({
|
|
15812
16778
|
Result: "Failure",
|
|
15813
|
-
Message: `No
|
|
15814
|
-
Instructions: "Try a different keyword. Connector activity names can differ from the vendor's marketing name (e.g. 'Newest Email' vs 'Latest Email')."
|
|
16779
|
+
Message: warnings.length > 0 ? `No ${searched} matched '${keyword}'. ${warnings.join(" ")}` : `No ${searched} matched '${keyword}'`,
|
|
16780
|
+
Instructions: kind === "all" ? "Try a different keyword. Connector activity names can differ from the vendor's marketing name (e.g. 'Newest Email' vs 'Latest Email')." : `Try a different keyword, or drop --kind ${kind} to search the other catalog too.`
|
|
15815
16781
|
});
|
|
15816
16782
|
processContext.exit(1);
|
|
15817
16783
|
return;
|
|
@@ -15821,12 +16787,14 @@ Subcommands:
|
|
|
15821
16787
|
Code: "ActivityResolveSuccess",
|
|
15822
16788
|
Data: {
|
|
15823
16789
|
Keyword: keyword,
|
|
16790
|
+
Kind: kind,
|
|
15824
16791
|
ResultCount: matches.length,
|
|
15825
|
-
Matches: matches
|
|
16792
|
+
Matches: matches,
|
|
16793
|
+
Warnings: warnings.length > 0 ? warnings : undefined
|
|
15826
16794
|
}
|
|
15827
16795
|
});
|
|
15828
16796
|
});
|
|
15829
|
-
registry.command("stub").description('Emit a ready-to-paste activity object for a known uiPathActivityTypeId. Combines TypeCache (GUID + InstanceParameters) with IS Elements metadata (full path, fields, multipart). Picks the "Http" kind for the HTTP connector and the "IntSvc" kind for vendor connectors.').argument("<activity-type-id>", "uiPathActivityTypeId from 'resolve'").option("--connection-id <id>", "Connection UUID (required for IntSvc-kind vendor activities; should be pre-pinged via 'uip is connections ping')").option("--instance <n>", "Instance number for slot key + export bucket suffix (default: 1)", "1").option("--slot-key <key>", "Override the default PascalCase slot key (e.g. 'GetNewestEmail_1')").option("--inputs <json>", `JSON object mapping field names to values (e.g. '{"message.subject":"hi"}')`).option("--object-name <name>", "Target connector object for Generic activities (e.g. 'tickets'); discover via 'uip is resources list <connector-key>'. Defaults to the object pinned in the
|
|
16797
|
+
registry.command("stub").description('Emit a ready-to-paste activity object for a known uiPathActivityTypeId. Combines TypeCache (GUID + InstanceParameters) with IS Elements metadata (full path, fields, multipart). Picks the "Http" kind for the HTTP connector and the "IntSvc" kind for vendor connectors.').argument("<activity-type-id>", "uiPathActivityTypeId from 'resolve'").option("--connection-id <id>", "Connection UUID (required for IntSvc-kind vendor activities; should be pre-pinged via 'uip is connections ping')").option("--instance <n>", "Instance number for slot key + export bucket suffix (default: 1)", "1").option("--slot-key <key>", "Override the default PascalCase slot key (e.g. 'GetNewestEmail_1')").option("--inputs <json>", `JSON object mapping field names to values (e.g. '{"message.subject":"hi"}')`).option("--object-name <name>", "Target connector object for Generic activities (e.g. 'tickets'); discover via 'uip is resources list <connector-key>'. For a GenericTrigger, the object the event applies to; discover via 'uip is triggers objects <connector-key> <EVENT>'. Defaults to the object pinned in the definition, when present.").option("--resource-key <field>=<key>", "Bind a Solution-resource picker field to a solution resource key (repeatable; e.g. --resource-key 'ReleaseName=87ec3255-...'). Renders the picker selection in StudioWeb; find keys in the solution's resources/ folder.", collectRepeatable, []).trackedAction(processContext, async (activityTypeId, options) => {
|
|
15830
16798
|
const instanceNumber = Number.parseInt(options.instance ?? "1", 10);
|
|
15831
16799
|
if (Number.isNaN(instanceNumber) || instanceNumber < 1) {
|
|
15832
16800
|
OutputFormatter.error({
|
|
@@ -15907,6 +16875,8 @@ Subcommands:
|
|
|
15907
16875
|
RequestFields: result.requestFields,
|
|
15908
16876
|
ResponseFields: result.responseFields,
|
|
15909
16877
|
SolutionResourceFields: result.solutionResourceFields.length > 0 ? result.solutionResourceFields : undefined,
|
|
16878
|
+
EventParameters: result.eventParameters,
|
|
16879
|
+
FilterFields: result.filterFields,
|
|
15910
16880
|
IsEnrichmentAvailable: result.isEnrichmentAvailable,
|
|
15911
16881
|
Warnings: result.warnings.length > 0 ? result.warnings : undefined
|
|
15912
16882
|
}
|
|
@@ -16678,11 +17648,11 @@ var VALID_ACTIVITY_TYPES = [
|
|
|
16678
17648
|
"Connector",
|
|
16679
17649
|
"Sequence",
|
|
16680
17650
|
"JsInvoke",
|
|
17651
|
+
"LogMessage",
|
|
16681
17652
|
"TryCatch",
|
|
16682
17653
|
"Response",
|
|
16683
17654
|
"Assign",
|
|
16684
17655
|
"Wait",
|
|
16685
|
-
"CustomLog",
|
|
16686
17656
|
"Base64ToFile",
|
|
16687
17657
|
"FileToBase64",
|
|
16688
17658
|
"Unresolved"
|
|
@@ -16691,6 +17661,11 @@ var BASE64_ACTIVITY_HELPERS = {
|
|
|
16691
17661
|
Base64ToFile: "$helpers.file.base64ToFile",
|
|
16692
17662
|
FileToBase64: "$helpers.file.fileToBase64"
|
|
16693
17663
|
};
|
|
17664
|
+
var LOG_MESSAGE_CALL_PREFIXES = [
|
|
17665
|
+
"console.log(",
|
|
17666
|
+
"console.warn(",
|
|
17667
|
+
"console.error("
|
|
17668
|
+
];
|
|
16694
17669
|
var ACTIVITY_REQUIRED_KEYS = {
|
|
16695
17670
|
If: {
|
|
16696
17671
|
required: ["do"],
|
|
@@ -16703,6 +17678,10 @@ var ACTIVITY_REQUIRED_KEYS = {
|
|
|
16703
17678
|
required: ["run"],
|
|
16704
17679
|
description: "must contain 'run' with script"
|
|
16705
17680
|
},
|
|
17681
|
+
LogMessage: {
|
|
17682
|
+
required: ["run"],
|
|
17683
|
+
description: "must contain 'run' with a script calling console.log"
|
|
17684
|
+
},
|
|
16706
17685
|
ForEach: {
|
|
16707
17686
|
required: ["for", "do"],
|
|
16708
17687
|
description: "must contain 'for' and 'do'"
|
|
@@ -16722,7 +17701,6 @@ var ACTIVITY_REQUIRED_KEYS = {
|
|
|
16722
17701
|
},
|
|
16723
17702
|
Assign: { required: ["set"], description: "must contain 'set'" },
|
|
16724
17703
|
Wait: { required: ["wait"], description: "must contain 'wait'" },
|
|
16725
|
-
CustomLog: { required: ["call"], description: "must contain 'call'" },
|
|
16726
17704
|
Base64ToFile: {
|
|
16727
17705
|
required: ["run"],
|
|
16728
17706
|
description: "must contain 'run' with a script calling $helpers.file.base64ToFile"
|
|
@@ -16825,8 +17803,35 @@ function semanticValidation(parsed) {
|
|
|
16825
17803
|
if (Array.isArray(workflow.do)) {
|
|
16826
17804
|
walkTaskList(workflow.do, "/do", issues);
|
|
16827
17805
|
}
|
|
17806
|
+
validateStartTriggers(workflow, issues);
|
|
16828
17807
|
return issues;
|
|
16829
17808
|
}
|
|
17809
|
+
function validateStartTriggers(workflow, issues) {
|
|
17810
|
+
const triggers = [];
|
|
17811
|
+
walkTasks(workflow.do, "/do", (name, task, path) => {
|
|
17812
|
+
if (isStartTriggerTask(task))
|
|
17813
|
+
triggers.push({ name, path, task });
|
|
17814
|
+
});
|
|
17815
|
+
if (triggers.length === 0)
|
|
17816
|
+
return;
|
|
17817
|
+
if (triggers.length > 1) {
|
|
17818
|
+
issues.push({
|
|
17819
|
+
path: "/do",
|
|
17820
|
+
message: `Workflow has ${triggers.length} start triggers (${triggers.map((t) => `'${t.name}'`).join(", ")}). A workflow starts from exactly one trigger; keep one and remove the rest`,
|
|
17821
|
+
severity: "error"
|
|
17822
|
+
});
|
|
17823
|
+
}
|
|
17824
|
+
const slot = startTriggerSlot(workflow);
|
|
17825
|
+
for (const trigger of triggers) {
|
|
17826
|
+
if (trigger.task !== slot) {
|
|
17827
|
+
issues.push({
|
|
17828
|
+
path: trigger.path,
|
|
17829
|
+
message: `Start trigger '${trigger.name}' must be the first activity after 'WorkflowStart' in the root Sequence. Move it there; anywhere else it does not start the workflow`,
|
|
17830
|
+
severity: "error"
|
|
17831
|
+
});
|
|
17832
|
+
}
|
|
17833
|
+
}
|
|
17834
|
+
}
|
|
16830
17835
|
function validateEvaluate(workflow, issues) {
|
|
16831
17836
|
if (!workflow.evaluate)
|
|
16832
17837
|
return;
|
|
@@ -17001,6 +18006,7 @@ function validateTask(task, taskName, taskPath, issues, skipMetadataWarnings = f
|
|
|
17001
18006
|
validateConnectorConfiguration(task, taskName, taskPath, issues);
|
|
17002
18007
|
validateIfBranches(task, taskName, taskPath, issues);
|
|
17003
18008
|
validateBase64Helper(task, taskName, taskPath, issues);
|
|
18009
|
+
validateLogMessage(task, taskName, taskPath, issues);
|
|
17004
18010
|
if (!task.metadata?.displayName && !skipMeta) {
|
|
17005
18011
|
issues.push({
|
|
17006
18012
|
path: `${taskPath}/metadata`,
|
|
@@ -17158,6 +18164,29 @@ function validateBase64Helper(task, taskName, taskPath, issues) {
|
|
|
17158
18164
|
});
|
|
17159
18165
|
}
|
|
17160
18166
|
}
|
|
18167
|
+
function validateLogMessage(task, taskName, taskPath, issues) {
|
|
18168
|
+
if (task.metadata?.activityType !== "LogMessage")
|
|
18169
|
+
return;
|
|
18170
|
+
if (!task.run)
|
|
18171
|
+
return;
|
|
18172
|
+
const language = task.run.script?.language;
|
|
18173
|
+
if (language !== undefined && language !== "javascript") {
|
|
18174
|
+
issues.push({
|
|
18175
|
+
path: `${taskPath}/run/script/language`,
|
|
18176
|
+
message: `Task '${taskName}' has activityType 'LogMessage' but 'run.script.language' is '${String(language)}'. Use "javascript"`,
|
|
18177
|
+
severity: "error"
|
|
18178
|
+
});
|
|
18179
|
+
}
|
|
18180
|
+
const code = task.run.script?.code;
|
|
18181
|
+
const isCanonicalCall = typeof code === "string" && code.endsWith(")") && LOG_MESSAGE_CALL_PREFIXES.some((prefix) => code.startsWith(prefix) && code.length > prefix.length + 1);
|
|
18182
|
+
if (!isCanonicalCall) {
|
|
18183
|
+
issues.push({
|
|
18184
|
+
path: `${taskPath}/run/script/code`,
|
|
18185
|
+
message: `Task '${taskName}' has activityType 'LogMessage' but its script is not a single console.log(<message>), console.warn(<message>) or console.error(<message>) call. Studio Web reads the level and message from that exact shape — no leading whitespace, no trailing ';' — and rewrites anything else when the activity is saved there`,
|
|
18186
|
+
severity: "error"
|
|
18187
|
+
});
|
|
18188
|
+
}
|
|
18189
|
+
}
|
|
17161
18190
|
function isConnectorTask(task) {
|
|
17162
18191
|
return typeof task.with?.connector === "string" || task.metadata?.activityType === "Connector";
|
|
17163
18192
|
}
|
|
@@ -17352,4 +18381,4 @@ var registerCommands = async (program) => {
|
|
|
17352
18381
|
|
|
17353
18382
|
export { metadata, registerCommands };
|
|
17354
18383
|
|
|
17355
|
-
//# debugId=
|
|
18384
|
+
//# debugId=168C025658562DD464756E2164756E21
|