@uipath/case-tool 1.201.0 → 1.202.0-preview.136
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/{authoring-aaaqwck3.js → authoring-cvjhkfxp.js} +74 -48
- package/dist/{browser-strategy-rkcvc6tn.js → browser-strategy-6atc7v8s.js} +3 -3
- package/dist/case-api-bwcxsbxe.js +381 -0
- package/dist/case-debug-studio-web-service-qcb328bt.js +335 -0
- package/dist/{case-pack-service-bxas5bxz.js → case-pack-service-txby2znw.js} +11 -18
- package/dist/case-validate-service-0q8krj2a.js +2114 -0
- package/dist/connector-enrichment-service-agqxam5y.js +60 -0
- package/dist/connector-lookup-service-ycgk77n0.js +22 -0
- package/dist/connector-task-spec-kdx5bv87.js +1250 -0
- package/dist/{de-5KVP66U6-t37qr521.js → de-5KVP66U6-1bnf4zt5.js} +54 -54
- package/dist/{de-5HU6GFWV-zheyw6d2.js → de-7XQXX2DK-tqdy5n2b.js} +857 -845
- package/dist/debug-service-dxx5pfev.js +57 -0
- package/dist/{en-MABQK6C4-nkzq2j8t.js → en-5ZGC5VQ3-h581y30k.js} +897 -897
- package/dist/{en-4KXU7N7B-24v330b5.js → en-X3S6IZ5J-nhkg6pwn.js} +55 -61
- package/dist/enrichment-service-ebz1f4ds.js +421 -0
- package/dist/{es-MX-POESXYP2-9538722k.js → es-MX-U2VN3SZW-anynsmd8.js} +857 -845
- package/dist/{es-MX-XAVLOQW3-47a405kf.js → es-MX-XAVLOQW3-q00km2y7.js} +54 -54
- package/dist/{es-VFPNVMP5-6sftsdxe.js → es-VFPNVMP5-bx2c337j.js} +54 -54
- package/dist/{es-LUTYN7U7-ye5zn4sn.js → es-ZGCPPOME-8gazspjj.js} +857 -845
- package/dist/{fr-E5MDO4EG-f3x1jeqw.js → fr-E5MDO4EG-c3mkty2t.js} +54 -54
- package/dist/{fr-LJIK56LW-xf3xf2kh.js → fr-T3G5GZCT-y3f7xb1q.js} +857 -845
- package/dist/{index-cncq089f.js → index-7s201ka0.js} +163 -80
- package/dist/{index-hsadteg4.js → index-h8cph72k.js} +4 -4
- package/dist/index-k4xz16db.js +63712 -0
- package/dist/{index-p50kx6jv.js → index-k5tbd184.js} +276 -276
- package/dist/index-kwxe1vep.js +143 -0
- package/dist/{index-9f8q2ege.js → index-p3vk57z7.js} +27 -27
- package/dist/index-qyf1dee9.js +630 -0
- package/dist/index.js +16 -17
- package/dist/{index.umd.min-drpc57vn.js → index.umd.min-fqefd9kn.js} +3 -3
- package/dist/input-reader-xb9vecxv.js +11 -0
- package/dist/{ja-FGEGLBJ3-w9byjhze.js → ja-BI5K3JDZ-77zat4z2.js} +857 -845
- package/dist/{ja-DPO5PPLO-fmbg7zt2.js → ja-DPO5PPLO-mysfmznx.js} +54 -54
- package/dist/{js-yaml-cggj6w7q.js → js-yaml-87cdx6bm.js} +27 -19
- package/dist/known-types-qryebm95.js +15 -0
- package/dist/{ko-ITOPNIYI-aqy82jk8.js → ko-ITOPNIYI-hmxd2asd.js} +54 -54
- package/dist/{ko-TUAK3G3A-s25w0ckg.js → ko-JOBF5V7N-4bv0mjje.js} +857 -845
- package/dist/{node-strategy-8gzp67xs.js → node-strategy-0267x5e5.js} +130 -14
- package/dist/node-sync-service-9a9ksj9s.js +38 -0
- package/dist/{packager-tool-9qecd4wb.js → packager-tool-0gctz400.js} +5 -2
- package/dist/packager-tool-0mj06yen.js +65 -0
- package/dist/{packager-tool-1cb0d5e0.js → packager-tool-0v3s8r01.js} +2 -2
- package/dist/packager-tool-134mvmcm.js +3040 -0
- package/dist/{packager-tool-wckvcay0.js → packager-tool-1yh8g550.js} +9 -7
- package/dist/{packager-tool-zqa5k9f7.js → packager-tool-37zvccmt.js} +990 -2287
- package/dist/packager-tool-3ze5vt52.js +54 -0
- package/dist/{packager-tool-w3h8xrnv.js → packager-tool-56j6keqr.js} +71 -3
- package/dist/{packager-tool-3wygxefb.js → packager-tool-58q3tvh7.js} +10 -10
- package/dist/{packager-tool-zx48pq4v.js → packager-tool-5ax2ywcg.js} +1997 -1174
- package/dist/{packager-tool-we1phz71.js → packager-tool-885mmrvr.js} +31 -3
- package/dist/packager-tool-9scn4b15.js +852 -0
- package/dist/{packager-tool-p9j43p8h.js → packager-tool-a42jnpy5.js} +3 -9
- package/dist/packager-tool-ajvse9r3.js +356 -0
- package/dist/{packager-tool-jysvpt8p.js → packager-tool-c23zrhj8.js} +2 -2
- package/dist/packager-tool-dqs5qy9s.js +2327 -0
- package/dist/packager-tool-ee5dhff3.js +6717 -0
- package/dist/{packager-tool-wvqz81mx.js → packager-tool-gtzs471w.js} +3 -2
- package/dist/packager-tool-hrr0efqc.js +546 -0
- package/dist/packager-tool-j9rfdrdm.js +1125 -0
- package/dist/{packager-tool-gq6952nc.js → packager-tool-jhdf8gt1.js} +5054 -17851
- package/dist/packager-tool-mp59jtpm.js +6865 -0
- package/dist/packager-tool-njzcfve1.js +77 -0
- package/dist/packager-tool-p7jgrm5r.js +15 -0
- package/dist/packager-tool-r84ng21s.js +57 -0
- package/dist/packager-tool-rqvr63x5.js +1217 -0
- package/dist/packager-tool-s12392rd.js +80 -0
- package/dist/packager-tool-sv0d6wb6.js +173 -0
- package/dist/packager-tool-ty1t2byf.js +27 -0
- package/dist/packager-tool-vepqrsse.js +23 -0
- package/dist/packager-tool-w5ek334f.js +4892 -0
- package/dist/{packager-tool-5arsyj36.js → packager-tool-yc4kw997.js} +4 -2
- package/dist/packager-tool.js +91 -5
- package/dist/project-artifacts-vhanbtw5.js +14 -0
- package/dist/{pt-BR-7XGDXRDJ-espnkgrj.js → pt-BR-7DYX2YPT-fqxqzqtf.js} +857 -845
- package/dist/{pt-BR-BXURWX4W-xzyndmrx.js → pt-BR-BXURWX4W-bwfcwhk1.js} +54 -54
- package/dist/{pt-TMVOOITK-myha14p9.js → pt-HTXGGX6Y-97t21dty.js} +857 -845
- package/dist/{pt-YI4VE4YQ-521681zf.js → pt-YI4VE4YQ-wdkn2dcf.js} +54 -54
- package/dist/resourcesSyncService-mrmmwaqr.js +683 -0
- package/dist/{ro-2VALF3S5-cdz5afkr.js → ro-KTNQ3MNU-y08n1x5g.js} +857 -845
- package/dist/{ro-RKXZUG7Z-pdztdafr.js → ro-RKXZUG7Z-nndrrsq7.js} +54 -54
- package/dist/{ru-GSCT4ARZ-qj8dm4dp.js → ru-GSCT4ARZ-1sa9wbr8.js} +1 -1
- package/dist/ru-WBLQ5B2U-8r3c7v6d.js +10 -0
- package/dist/strict-case-rules-303vjvas.js +377 -0
- package/dist/strict-sdd-audit-qdmc9e1y.js +1024 -0
- package/dist/tool.js +17 -18
- package/dist/{tr-AA6O2WSR-bj9n80k8.js → tr-AA6O2WSR-86ba4bdf.js} +54 -54
- package/dist/{tr-RIFCEXFH-hgkb4g8y.js → tr-XHSSPNK7-cmqyc4wd.js} +857 -845
- package/dist/trigger-enrichment-service-zdx4x92j.js +340 -0
- package/dist/{zh-CN-IP3FMXWM-1cfarhcp.js → zh-CN-2EHQT23P-mr63c4xz.js} +857 -845
- package/dist/{zh-CN-R2KLHXQV-x6gnk2n0.js → zh-CN-R2KLHXQV-agqr45ds.js} +54 -54
- package/dist/{zh-TW-AGIDXIPF-n6r6w7vy.js → zh-TW-MGZCE5BT-c4ekmrz9.js} +857 -845
- package/dist/{zh-TW-RJGCQANM-tt8j5wv2.js → zh-TW-RJGCQANM-w0x3qc1p.js} +54 -54
- package/package.json +2 -2
- package/dist/index-8bsngk9y.js +0 -247140
- package/dist/packager-tool-axcdppp9.js +0 -13607
- package/dist/ru-WBLQ5B2U-8xd4gpv2.js +0 -10
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
import"./packager-tool-134mvmcm.js";
|
|
2
|
+
import {
|
|
3
|
+
findSolutionFromCwd
|
|
4
|
+
} from "./packager-tool-rqvr63x5.js";
|
|
5
|
+
import"./packager-tool-885mmrvr.js";
|
|
6
|
+
import"./packager-tool-mp59jtpm.js";
|
|
7
|
+
import {
|
|
8
|
+
loadIndexMetadata,
|
|
9
|
+
loadResourceIndex,
|
|
10
|
+
saveIndexMetadata,
|
|
11
|
+
saveResourceIndex
|
|
12
|
+
} from "./packager-tool-s12392rd.js";
|
|
13
|
+
import"./packager-tool-jhdf8gt1.js";
|
|
14
|
+
import"./packager-tool-58q3tvh7.js";
|
|
15
|
+
import"./packager-tool-sc961w0q.js";
|
|
16
|
+
import"./packager-tool-a42jnpy5.js";
|
|
17
|
+
import"./packager-tool-c23zrhj8.js";
|
|
18
|
+
import"./packager-tool-37zvccmt.js";
|
|
19
|
+
import"./packager-tool-j9rfdrdm.js";
|
|
20
|
+
import {
|
|
21
|
+
GET_SEARCHABLE_TYPES,
|
|
22
|
+
RESOURCE_TYPES
|
|
23
|
+
} from "./packager-tool-r84ng21s.js";
|
|
24
|
+
import"./packager-tool-9scn4b15.js";
|
|
25
|
+
import"./packager-tool-3ze5vt52.js";
|
|
26
|
+
import"./packager-tool-vepqrsse.js";
|
|
27
|
+
import {
|
|
28
|
+
getLoginStatusAsync
|
|
29
|
+
} from "./packager-tool-dqs5qy9s.js";
|
|
30
|
+
import"./packager-tool-qa9gftnj.js";
|
|
31
|
+
import {
|
|
32
|
+
catchError,
|
|
33
|
+
hashContent,
|
|
34
|
+
logger
|
|
35
|
+
} from "./packager-tool-5ax2ywcg.js";
|
|
36
|
+
import {
|
|
37
|
+
getFileSystem
|
|
38
|
+
} from "./packager-tool-0v3s8r01.js";
|
|
39
|
+
import"./packager-tool-0gctz400.js";
|
|
40
|
+
import"./packager-tool-yc4kw997.js";
|
|
41
|
+
import"./packager-tool-1yh8g550.js";
|
|
42
|
+
|
|
43
|
+
// src/services/action-app-api.ts
|
|
44
|
+
var ACTION_APP_BATCH_SIZE = 100;
|
|
45
|
+
async function listActionApps() {
|
|
46
|
+
const loginStatus = await getLoginStatusAsync();
|
|
47
|
+
if (loginStatus.loginStatus !== "Logged in" || !loginStatus.baseUrl || !loginStatus.organizationId || !loginStatus.tenantId || !loginStatus.accessToken) {
|
|
48
|
+
throw new Error("Not logged in. Run 'uip login' first.");
|
|
49
|
+
}
|
|
50
|
+
const all = [];
|
|
51
|
+
const MAX_PAGES = 100;
|
|
52
|
+
let pageNumber = 0;
|
|
53
|
+
while (pageNumber < MAX_PAGES) {
|
|
54
|
+
if (pageNumber === MAX_PAGES - 1) {
|
|
55
|
+
logger.warn(`Fetching the last allowed page (${MAX_PAGES}). Results may be truncated.`);
|
|
56
|
+
}
|
|
57
|
+
const query = new URLSearchParams({
|
|
58
|
+
state: "deployed",
|
|
59
|
+
pageNumber: String(pageNumber),
|
|
60
|
+
limit: String(ACTION_APP_BATCH_SIZE)
|
|
61
|
+
});
|
|
62
|
+
const url = `${loginStatus.baseUrl}/${loginStatus.organizationId}/apps_/default/api/v1/default/action-apps?${query}`;
|
|
63
|
+
logger.debug(`Listing action apps with URL: ${url}`);
|
|
64
|
+
const response = await fetch(url, {
|
|
65
|
+
method: "GET",
|
|
66
|
+
headers: {
|
|
67
|
+
Authorization: `Bearer ${loginStatus.accessToken}`,
|
|
68
|
+
"Content-Type": "application/json",
|
|
69
|
+
"X-Uipath-Tenantid": loginStatus.tenantId,
|
|
70
|
+
Accept: "application/json"
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
if (!response.ok) {
|
|
74
|
+
const errorText = await response.text();
|
|
75
|
+
logger.error(`Error response body: ${errorText}`);
|
|
76
|
+
throw new Error(`Action apps list failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
77
|
+
}
|
|
78
|
+
const data = await response.json();
|
|
79
|
+
const page = data.deployed ?? [];
|
|
80
|
+
all.push(...page);
|
|
81
|
+
if (page.length < ACTION_APP_BATCH_SIZE)
|
|
82
|
+
break;
|
|
83
|
+
pageNumber += 1;
|
|
84
|
+
}
|
|
85
|
+
return all;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// src/services/filterEngine.ts
|
|
89
|
+
function readField(resource, field) {
|
|
90
|
+
const direct = resource[field];
|
|
91
|
+
if (direct !== undefined)
|
|
92
|
+
return direct;
|
|
93
|
+
const cfg = resource.configuration;
|
|
94
|
+
if (typeof cfg === "string") {
|
|
95
|
+
try {
|
|
96
|
+
const parsed = JSON.parse(cfg);
|
|
97
|
+
return parsed[field];
|
|
98
|
+
} catch {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
function matchesKeyword(resource, keyword) {
|
|
105
|
+
const lower = keyword.toLowerCase();
|
|
106
|
+
const searchFields = [
|
|
107
|
+
"name",
|
|
108
|
+
"title",
|
|
109
|
+
"displayName",
|
|
110
|
+
"description",
|
|
111
|
+
"category",
|
|
112
|
+
"connectorKey",
|
|
113
|
+
"systemName",
|
|
114
|
+
"tags"
|
|
115
|
+
];
|
|
116
|
+
return searchFields.some((field) => {
|
|
117
|
+
const val = readField(resource, field);
|
|
118
|
+
if (typeof val === "string")
|
|
119
|
+
return val.toLowerCase().includes(lower);
|
|
120
|
+
if (Array.isArray(val))
|
|
121
|
+
return val.some((v) => typeof v === "string" && v.toLowerCase().includes(lower));
|
|
122
|
+
return false;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function matchesFilter(resource, field, operator, value) {
|
|
126
|
+
const raw = readField(resource, field) ?? (field === "name" ? resource.displayName : undefined);
|
|
127
|
+
const fieldValues = Array.isArray(raw) ? raw.filter((v) => typeof v === "string") : typeof raw === "string" ? [raw] : [];
|
|
128
|
+
const lowerValue = value.toLowerCase();
|
|
129
|
+
return fieldValues.some((v) => {
|
|
130
|
+
const lv = v.toLowerCase();
|
|
131
|
+
switch (operator) {
|
|
132
|
+
case "equals":
|
|
133
|
+
return lv === lowerValue;
|
|
134
|
+
case "contains":
|
|
135
|
+
return lv.includes(lowerValue);
|
|
136
|
+
case "startsWith":
|
|
137
|
+
return lv.startsWith(lowerValue);
|
|
138
|
+
case "endsWith":
|
|
139
|
+
return lv.endsWith(lowerValue);
|
|
140
|
+
case "in":
|
|
141
|
+
return lowerValue.split("|").map((s) => s.trim()).includes(lv);
|
|
142
|
+
default:
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function searchWithFilters(resources, keyword, filters) {
|
|
148
|
+
return resources.filter((resource) => {
|
|
149
|
+
if (keyword && !matchesKeyword(resource, keyword))
|
|
150
|
+
return false;
|
|
151
|
+
if (filters && filters.filters.length > 0) {
|
|
152
|
+
const filterResults = filters.filters.map(({ field, operator, value }) => matchesFilter(resource, field, operator, value));
|
|
153
|
+
if (filters.logic === "AND")
|
|
154
|
+
return filterResults.every(Boolean);
|
|
155
|
+
return filterResults.some(Boolean);
|
|
156
|
+
}
|
|
157
|
+
return true;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// src/services/localSolutionDiscovery.ts
|
|
162
|
+
var LOCAL_RESOURCE_TYPES = new Set([
|
|
163
|
+
"agent",
|
|
164
|
+
"process",
|
|
165
|
+
"api",
|
|
166
|
+
"processOrchestration",
|
|
167
|
+
"caseManagement"
|
|
168
|
+
]);
|
|
169
|
+
var PROJECT_TYPE_TO_RESOURCE = {
|
|
170
|
+
Agent: "agent",
|
|
171
|
+
Process: "process",
|
|
172
|
+
Api: "api",
|
|
173
|
+
ProcessOrchestration: "processOrchestration",
|
|
174
|
+
CaseManagement: "caseManagement"
|
|
175
|
+
};
|
|
176
|
+
var PROJECT_TYPE_TO_RESOURCE_LC = Object.fromEntries(Object.entries(PROJECT_TYPE_TO_RESOURCE).map(([k, v]) => [
|
|
177
|
+
k.toLowerCase(),
|
|
178
|
+
v
|
|
179
|
+
]));
|
|
180
|
+
var PROCESS_SUBDIR = ["resources", "solution_folder", "process"];
|
|
181
|
+
function isUnder(parent, child) {
|
|
182
|
+
if (child === parent)
|
|
183
|
+
return true;
|
|
184
|
+
const fs = getFileSystem();
|
|
185
|
+
const rel = fs.path.relative(parent, child);
|
|
186
|
+
return rel !== "" && !rel.startsWith("..") && !fs.path.isAbsolute(rel);
|
|
187
|
+
}
|
|
188
|
+
async function parseEnrichmentFile(filePath) {
|
|
189
|
+
const fs = getFileSystem();
|
|
190
|
+
const [readErr, content] = await catchError(fs.readFile(filePath, "utf-8"));
|
|
191
|
+
if (readErr || !content)
|
|
192
|
+
return null;
|
|
193
|
+
const [parseErr, parsed] = catchError(() => JSON.parse(content));
|
|
194
|
+
if (parseErr || !parsed.resource?.projectKey)
|
|
195
|
+
return null;
|
|
196
|
+
const r = parsed.resource;
|
|
197
|
+
return [
|
|
198
|
+
r.projectKey,
|
|
199
|
+
{
|
|
200
|
+
key: r.key,
|
|
201
|
+
name: r.name,
|
|
202
|
+
folders: r.folders && r.folders.length > 0 ? r.folders.map((f) => ({
|
|
203
|
+
fullyQualifiedName: f.fullyQualifiedName ?? "solution_folder"
|
|
204
|
+
})) : undefined,
|
|
205
|
+
packageName: r.spec?.packageName
|
|
206
|
+
}
|
|
207
|
+
];
|
|
208
|
+
}
|
|
209
|
+
async function loadResourceEnrichmentMap(solutionDir) {
|
|
210
|
+
const fs = getFileSystem();
|
|
211
|
+
const map = new Map;
|
|
212
|
+
const processDir = fs.path.join(solutionDir, ...PROCESS_SUBDIR);
|
|
213
|
+
const [dirErr, typeDirs] = await catchError(fs.readdir(processDir));
|
|
214
|
+
if (dirErr || !Array.isArray(typeDirs))
|
|
215
|
+
return map;
|
|
216
|
+
for (const typeDir of typeDirs) {
|
|
217
|
+
const typePath = fs.path.join(processDir, typeDir);
|
|
218
|
+
const [filesErr, files] = await catchError(fs.readdir(typePath));
|
|
219
|
+
if (filesErr || !Array.isArray(files))
|
|
220
|
+
continue;
|
|
221
|
+
for (const file of files) {
|
|
222
|
+
if (!file.endsWith(".json"))
|
|
223
|
+
continue;
|
|
224
|
+
const entry = await parseEnrichmentFile(fs.path.join(typePath, file));
|
|
225
|
+
if (entry)
|
|
226
|
+
map.set(entry[0], entry[1]);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return map;
|
|
230
|
+
}
|
|
231
|
+
async function readProjectName(projectDir) {
|
|
232
|
+
const fs = getFileSystem();
|
|
233
|
+
const [err, content] = await catchError(fs.readFile(fs.path.join(projectDir, "project.uiproj"), "utf-8"));
|
|
234
|
+
if (!err && content) {
|
|
235
|
+
const [parseErr, parsed] = catchError(() => JSON.parse(content));
|
|
236
|
+
if (!parseErr && parsed.Name)
|
|
237
|
+
return parsed.Name;
|
|
238
|
+
}
|
|
239
|
+
return fs.path.basename(projectDir);
|
|
240
|
+
}
|
|
241
|
+
async function readEntryPointIO(projectDir) {
|
|
242
|
+
const fs = getFileSystem();
|
|
243
|
+
const candidates = [
|
|
244
|
+
fs.path.join(projectDir, "entry-points.json"),
|
|
245
|
+
fs.path.join(projectDir, "content", "entry-points.json")
|
|
246
|
+
];
|
|
247
|
+
for (const filePath of candidates) {
|
|
248
|
+
const [err, content] = await catchError(fs.readFile(filePath, "utf-8"));
|
|
249
|
+
if (err || !content)
|
|
250
|
+
continue;
|
|
251
|
+
const [parseErr, parsed] = catchError(() => JSON.parse(content));
|
|
252
|
+
if (parseErr || !parsed.entryPoints?.length)
|
|
253
|
+
continue;
|
|
254
|
+
const ep = parsed.entryPoints[0];
|
|
255
|
+
return {
|
|
256
|
+
inputs: ep.input ?? ep.InputArguments,
|
|
257
|
+
outputs: ep.output ?? ep.OutputArguments
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
return {};
|
|
261
|
+
}
|
|
262
|
+
async function readLocalResourcesForType(ctx, resourceType, enrichment) {
|
|
263
|
+
if (!LOCAL_RESOURCE_TYPES.has(resourceType))
|
|
264
|
+
return [];
|
|
265
|
+
const fs = getFileSystem();
|
|
266
|
+
const enrichmentMap = enrichment ?? await loadResourceEnrichmentMap(ctx.solutionDir);
|
|
267
|
+
const entries = [];
|
|
268
|
+
for (const project of ctx.projects) {
|
|
269
|
+
if (!project.Id || !project.Type)
|
|
270
|
+
continue;
|
|
271
|
+
if (ctx.currentProjectId && project.Id === ctx.currentProjectId)
|
|
272
|
+
continue;
|
|
273
|
+
if (PROJECT_TYPE_TO_RESOURCE_LC[project.Type.toLowerCase()] !== resourceType)
|
|
274
|
+
continue;
|
|
275
|
+
const projectDir = fs.path.resolve(ctx.solutionDir, fs.path.dirname(project.ProjectRelativePath ?? ""));
|
|
276
|
+
if (!isUnder(ctx.solutionDir, projectDir))
|
|
277
|
+
continue;
|
|
278
|
+
const enriched = enrichmentMap.get(project.Id);
|
|
279
|
+
const [name, io] = await Promise.all([
|
|
280
|
+
enriched?.name ? Promise.resolve(enriched.name) : readProjectName(projectDir),
|
|
281
|
+
readEntryPointIO(projectDir)
|
|
282
|
+
]);
|
|
283
|
+
entries.push({
|
|
284
|
+
entityKey: enriched?.key ?? project.Id,
|
|
285
|
+
name,
|
|
286
|
+
category: resourceType,
|
|
287
|
+
folders: enriched?.folders ?? [
|
|
288
|
+
{ fullyQualifiedName: "solution_folder" }
|
|
289
|
+
],
|
|
290
|
+
packageName: enriched?.packageName,
|
|
291
|
+
projectKey: project.Id,
|
|
292
|
+
inputs: io.inputs,
|
|
293
|
+
outputs: io.outputs,
|
|
294
|
+
source: "local"
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
return entries;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// src/services/process-entity-api.ts
|
|
301
|
+
var PROCESS_ENTITY_BATCH_SIZE = 500;
|
|
302
|
+
async function listProcessEntities(params) {
|
|
303
|
+
const loginStatus = await getLoginStatusAsync();
|
|
304
|
+
if (loginStatus.loginStatus !== "Logged in" || !loginStatus.baseUrl || !loginStatus.organizationId || !loginStatus.tenantId || !loginStatus.accessToken) {
|
|
305
|
+
throw new Error("Not logged in. Run 'uip login' first.");
|
|
306
|
+
}
|
|
307
|
+
const all = [];
|
|
308
|
+
const MAX_PAGES = 20;
|
|
309
|
+
let pageNumber = 0;
|
|
310
|
+
while (pageNumber < MAX_PAGES) {
|
|
311
|
+
if (pageNumber === MAX_PAGES - 1) {
|
|
312
|
+
logger.warn(`Fetching the last allowed page (${MAX_PAGES}). Results may be truncated.`);
|
|
313
|
+
}
|
|
314
|
+
const query = new URLSearchParams({
|
|
315
|
+
entitySubType: params.entitySubType,
|
|
316
|
+
take: String(PROCESS_ENTITY_BATCH_SIZE),
|
|
317
|
+
skip: String(pageNumber * PROCESS_ENTITY_BATCH_SIZE)
|
|
318
|
+
});
|
|
319
|
+
const url = `${loginStatus.baseUrl}/${loginStatus.organizationId}/${loginStatus.tenantId}/resourcecatalog_/Entities/Process?${query}`;
|
|
320
|
+
logger.debug(`Listing process entities with URL: ${url}`);
|
|
321
|
+
const response = await fetch(url, {
|
|
322
|
+
method: "GET",
|
|
323
|
+
headers: {
|
|
324
|
+
Authorization: `Bearer ${loginStatus.accessToken}`,
|
|
325
|
+
"Content-Type": "application/json",
|
|
326
|
+
"X-Uipath-Tenantid": loginStatus.tenantId,
|
|
327
|
+
Accept: "application/json"
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
if (!response.ok) {
|
|
331
|
+
const errorText = await response.text();
|
|
332
|
+
logger.error(`Error response body: ${errorText}`);
|
|
333
|
+
throw new Error(`Process entity list failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
334
|
+
}
|
|
335
|
+
const data = await response.json();
|
|
336
|
+
const page = data.value ?? [];
|
|
337
|
+
all.push(...page);
|
|
338
|
+
if (page.length < PROCESS_ENTITY_BATCH_SIZE)
|
|
339
|
+
break;
|
|
340
|
+
pageNumber += 1;
|
|
341
|
+
}
|
|
342
|
+
return all;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// src/services/solution-entities-api.ts
|
|
346
|
+
async function listSolutionEntities(solutionId) {
|
|
347
|
+
const loginStatus = await getLoginStatusAsync();
|
|
348
|
+
if (loginStatus.loginStatus !== "Logged in" || !loginStatus.baseUrl || !loginStatus.organizationId || !loginStatus.tenantId || !loginStatus.accessToken) {
|
|
349
|
+
throw new Error("Not logged in. Run 'uip login' first.");
|
|
350
|
+
}
|
|
351
|
+
const url = `${loginStatus.baseUrl}/${loginStatus.organizationId}/studio_/backend/api/resourcebuilder/solutions/${solutionId}/entities`;
|
|
352
|
+
logger.debug(`Listing resource builder entities with URL: ${url}`);
|
|
353
|
+
const response = await fetch(url, {
|
|
354
|
+
method: "GET",
|
|
355
|
+
headers: {
|
|
356
|
+
Authorization: `Bearer ${loginStatus.accessToken}`,
|
|
357
|
+
"Content-Type": "application/json",
|
|
358
|
+
Accept: "application/json"
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
if (!response.ok) {
|
|
362
|
+
const errorText = await response.text();
|
|
363
|
+
logger.error(`Error response body: ${errorText}`);
|
|
364
|
+
throw new Error(`Resource builder entities list failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
365
|
+
}
|
|
366
|
+
const data = await response.json();
|
|
367
|
+
return data.resources ?? [];
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// src/services/studio-typecache-api.ts
|
|
371
|
+
var catalogPromises = new Map;
|
|
372
|
+
async function fetchSearchCatalog(projectType) {
|
|
373
|
+
const loginStatus = await getLoginStatusAsync();
|
|
374
|
+
if (loginStatus.loginStatus !== "Logged in" || !loginStatus.baseUrl || !loginStatus.organizationId || !loginStatus.accessToken || !loginStatus.tenantId) {
|
|
375
|
+
throw new Error("Not logged in. Run 'uip login' first.");
|
|
376
|
+
}
|
|
377
|
+
const query = new URLSearchParams({
|
|
378
|
+
useLucene: "false",
|
|
379
|
+
useElastic: "true",
|
|
380
|
+
projectType
|
|
381
|
+
});
|
|
382
|
+
const url = `${loginStatus.baseUrl}/${loginStatus.organizationId}/studio_/typecache/api/Search/Catalog?${query}`;
|
|
383
|
+
logger.debug(`Fetching Studio search catalog with URL: ${url}`);
|
|
384
|
+
const response = await fetch(url, {
|
|
385
|
+
method: "GET",
|
|
386
|
+
headers: {
|
|
387
|
+
Authorization: `Bearer ${loginStatus.accessToken}`,
|
|
388
|
+
"Content-Type": "application/json",
|
|
389
|
+
"X-Uipath-Tenantid": loginStatus.tenantId,
|
|
390
|
+
Accept: "application/json"
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
if (!response.ok) {
|
|
394
|
+
const errorText = await response.text();
|
|
395
|
+
logger.debug(`Error response body: ${errorText}`);
|
|
396
|
+
throw new Error(`catalog search failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
397
|
+
}
|
|
398
|
+
const data = await response.json();
|
|
399
|
+
if (!Array.isArray(data.activities) || !Array.isArray(data.triggers)) {
|
|
400
|
+
throw new Error(`catalog search returned unexpected shape: ${JSON.stringify(data).slice(0, 200)}`);
|
|
401
|
+
}
|
|
402
|
+
const packages = Array.isArray(data.packages) ? data.packages : [];
|
|
403
|
+
const activities = data.activities;
|
|
404
|
+
const triggers = data.triggers;
|
|
405
|
+
logger.debug(`Received ${projectType} catalog: ${activities.length} activities, ${triggers.length} triggers, ${packages.length} packages`);
|
|
406
|
+
return {
|
|
407
|
+
packages,
|
|
408
|
+
activities,
|
|
409
|
+
triggers
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
async function searchCatalog(projectType) {
|
|
413
|
+
let promise = catalogPromises.get(projectType);
|
|
414
|
+
if (!promise) {
|
|
415
|
+
promise = fetchSearchCatalog(projectType);
|
|
416
|
+
catalogPromises.set(projectType, promise);
|
|
417
|
+
promise.catch(() => {
|
|
418
|
+
catalogPromises.delete(projectType);
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
return promise;
|
|
422
|
+
}
|
|
423
|
+
async function searchActivities(projectType = "ProcessOrchestration") {
|
|
424
|
+
return (await searchCatalog(projectType)).activities;
|
|
425
|
+
}
|
|
426
|
+
async function searchTriggers(projectType = "ProcessOrchestration") {
|
|
427
|
+
return (await searchCatalog(projectType)).triggers;
|
|
428
|
+
}
|
|
429
|
+
async function searchPackages(projectType = "ProcessOrchestration") {
|
|
430
|
+
return (await searchCatalog(projectType)).packages;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// src/services/resourcesSyncService.ts
|
|
434
|
+
var CACHE_EXPIRATION = 24 * 60 * 60 * 1000;
|
|
435
|
+
var SLICE_FETCHERS = {
|
|
436
|
+
activities: searchActivities,
|
|
437
|
+
triggers: searchTriggers,
|
|
438
|
+
packages: searchPackages
|
|
439
|
+
};
|
|
440
|
+
var TYPECACHE_PREFIXES = [
|
|
441
|
+
["typecache", "ProcessOrchestration"],
|
|
442
|
+
["typecache-external-automation", "IntsvcExternalAutomation"],
|
|
443
|
+
["typecache-external-agent", "IntsvcExternalAgent"]
|
|
444
|
+
];
|
|
445
|
+
var TYPECACHE_SOURCES = Object.fromEntries(TYPECACHE_PREFIXES.flatMap(([prefix, projectType]) => Object.keys(SLICE_FETCHERS).map((slice) => [
|
|
446
|
+
`${prefix}-${slice}`,
|
|
447
|
+
{ projectType, slice }
|
|
448
|
+
])));
|
|
449
|
+
async function pullResources(options = {}, resourceType) {
|
|
450
|
+
const { force = false, solutionId = undefined } = options;
|
|
451
|
+
if (force) {
|
|
452
|
+
const refreshResult2 = await refreshResources(resourceType, solutionId);
|
|
453
|
+
const meta2 = await loadIndexMetadata(resourceType);
|
|
454
|
+
return {
|
|
455
|
+
syncedCount: refreshResult2.count || meta2?.count || 0,
|
|
456
|
+
fromCache: false,
|
|
457
|
+
cacheWritten: refreshResult2.cacheWritten,
|
|
458
|
+
info: refreshResult2.info
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
const meta = await loadIndexMetadata(resourceType);
|
|
462
|
+
if (meta) {
|
|
463
|
+
const ageMs = Date.now() - meta.lastSync;
|
|
464
|
+
if (ageMs < CACHE_EXPIRATION) {
|
|
465
|
+
return {
|
|
466
|
+
syncedCount: meta.count,
|
|
467
|
+
fromCache: true,
|
|
468
|
+
ageMinutes: Math.round(ageMs / 60000)
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
const refreshResult = await refreshResources(resourceType, solutionId);
|
|
473
|
+
const refreshedMeta = await loadIndexMetadata(resourceType);
|
|
474
|
+
return {
|
|
475
|
+
syncedCount: refreshResult.count || refreshedMeta?.count || 0,
|
|
476
|
+
fromCache: false,
|
|
477
|
+
cacheWritten: refreshResult.cacheWritten,
|
|
478
|
+
info: refreshResult.info
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
async function refreshResources(resourceType, solutionId) {
|
|
482
|
+
const oldMeta = await loadIndexMetadata(resourceType);
|
|
483
|
+
const pullResult = await pullRemoteResources(resourceType, solutionId);
|
|
484
|
+
const resources = pullResult.resources;
|
|
485
|
+
if (!pullResult.cacheable) {
|
|
486
|
+
return {
|
|
487
|
+
cacheWritten: false,
|
|
488
|
+
count: resources.length,
|
|
489
|
+
info: pullResult.info
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
const content = JSON.stringify(resources, null, 2);
|
|
493
|
+
const newHash = await hashContent(content);
|
|
494
|
+
if (oldMeta && oldMeta.hash === newHash) {
|
|
495
|
+
await saveIndexMetadata({
|
|
496
|
+
lastSync: Date.now(),
|
|
497
|
+
count: oldMeta.count,
|
|
498
|
+
hash: oldMeta.hash
|
|
499
|
+
}, resourceType);
|
|
500
|
+
return {
|
|
501
|
+
cacheWritten: true,
|
|
502
|
+
count: oldMeta.count
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
await saveResourceIndex(resources, resourceType);
|
|
506
|
+
return {
|
|
507
|
+
cacheWritten: true,
|
|
508
|
+
count: resources.length
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
async function pullRemoteResources(resourceType, solutionId) {
|
|
512
|
+
const typecacheSource = TYPECACHE_SOURCES[resourceType];
|
|
513
|
+
if (typecacheSource) {
|
|
514
|
+
return {
|
|
515
|
+
resources: await SLICE_FETCHERS[typecacheSource.slice](typecacheSource.projectType),
|
|
516
|
+
cacheable: true
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
switch (resourceType) {
|
|
520
|
+
case "action-apps":
|
|
521
|
+
return {
|
|
522
|
+
resources: await listActionApps(),
|
|
523
|
+
cacheable: true
|
|
524
|
+
};
|
|
525
|
+
case "agent":
|
|
526
|
+
case "process":
|
|
527
|
+
case "api":
|
|
528
|
+
case "processOrchestration":
|
|
529
|
+
case "caseManagement":
|
|
530
|
+
return {
|
|
531
|
+
resources: await listProcessEntities({
|
|
532
|
+
entitySubType: resourceType
|
|
533
|
+
}),
|
|
534
|
+
cacheable: true
|
|
535
|
+
};
|
|
536
|
+
case "flow":
|
|
537
|
+
return {
|
|
538
|
+
resources: await listProcessEntities({
|
|
539
|
+
entitySubType: "Flow"
|
|
540
|
+
}),
|
|
541
|
+
cacheable: true
|
|
542
|
+
};
|
|
543
|
+
case "solution":
|
|
544
|
+
if (!solutionId) {
|
|
545
|
+
return {
|
|
546
|
+
resources: [],
|
|
547
|
+
cacheable: false,
|
|
548
|
+
info: "Solution ID not provided. Skipping solution entities pull."
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
return {
|
|
552
|
+
resources: await listSolutionEntities(solutionId),
|
|
553
|
+
cacheable: true
|
|
554
|
+
};
|
|
555
|
+
default: {
|
|
556
|
+
return {
|
|
557
|
+
resources: [],
|
|
558
|
+
cacheable: false,
|
|
559
|
+
info: `Unknown resource type: ${resourceType}`
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
async function getResourcesWithCacheFallback(resourceType) {
|
|
565
|
+
const [error, resources] = await catchError(loadResourceIndex(resourceType));
|
|
566
|
+
if (error) {
|
|
567
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
568
|
+
if (!errorMessage.includes("No resource index found")) {
|
|
569
|
+
throw error;
|
|
570
|
+
}
|
|
571
|
+
const pullResult = await pullRemoteResources(resourceType);
|
|
572
|
+
if (pullResult.cacheable) {
|
|
573
|
+
await saveResourceIndex(pullResult.resources, resourceType);
|
|
574
|
+
}
|
|
575
|
+
return pullResult.resources;
|
|
576
|
+
}
|
|
577
|
+
return resources;
|
|
578
|
+
}
|
|
579
|
+
async function requireSolution() {
|
|
580
|
+
const ctx = await findSolutionFromCwd();
|
|
581
|
+
if (!ctx) {
|
|
582
|
+
throw new Error("No .uipx solution file found in the current directory, its parent, or its grandparent. Run this command from inside a solution project directory.");
|
|
583
|
+
}
|
|
584
|
+
return ctx;
|
|
585
|
+
}
|
|
586
|
+
async function listResources(resourceType) {
|
|
587
|
+
return getResourcesWithCacheFallback(resourceType);
|
|
588
|
+
}
|
|
589
|
+
async function listLocalResources() {
|
|
590
|
+
const ctx = await requireSolution();
|
|
591
|
+
const enrichment = await loadResourceEnrichmentMap(ctx.solutionDir);
|
|
592
|
+
const grouped = [];
|
|
593
|
+
for (const type of RESOURCE_TYPES) {
|
|
594
|
+
grouped.push({
|
|
595
|
+
type,
|
|
596
|
+
resources: await readLocalResourcesForType(ctx, type, enrichment)
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
return grouped;
|
|
600
|
+
}
|
|
601
|
+
async function searchResources(keyword, resourceType, options) {
|
|
602
|
+
return searchResourcesWithFilters(keyword, undefined, resourceType, options);
|
|
603
|
+
}
|
|
604
|
+
async function searchResourcesWithFilters(keyword, filters, resourceType, options) {
|
|
605
|
+
const types = resourceType ? [resourceType] : [...RESOURCE_TYPES];
|
|
606
|
+
const localCtx = options?.local ? await requireSolution() : null;
|
|
607
|
+
const enrichment = localCtx ? await loadResourceEnrichmentMap(localCtx.solutionDir) : null;
|
|
608
|
+
const settled = await Promise.allSettled(types.map((type) => (localCtx ? readLocalResourcesForType(localCtx, type, enrichment ?? undefined) : getResourcesWithCacheFallback(type)).then((resources) => ({
|
|
609
|
+
type,
|
|
610
|
+
resources
|
|
611
|
+
}))));
|
|
612
|
+
const results = [];
|
|
613
|
+
const failedTypes = [];
|
|
614
|
+
for (let i = 0;i < settled.length; i++) {
|
|
615
|
+
const result = settled[i];
|
|
616
|
+
if (result.status !== "fulfilled") {
|
|
617
|
+
const reason = result.reason;
|
|
618
|
+
failedTypes.push({
|
|
619
|
+
type: types[i],
|
|
620
|
+
error: reason instanceof Error ? reason.message : String(reason)
|
|
621
|
+
});
|
|
622
|
+
continue;
|
|
623
|
+
}
|
|
624
|
+
const { type, resources } = result.value;
|
|
625
|
+
const matched = searchWithFilters(resources, keyword, filters);
|
|
626
|
+
for (const resource of matched) {
|
|
627
|
+
results.push({ resourceType: type, resource });
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
if (failedTypes.length === types.length) {
|
|
631
|
+
throw new Error(`Failed to load resources for all types: ${failedTypes.map((f) => f.type).join(", ")}`);
|
|
632
|
+
}
|
|
633
|
+
return { results, failedTypes };
|
|
634
|
+
}
|
|
635
|
+
async function getLocalResources(identifier, resourceType) {
|
|
636
|
+
const ctx = await requireSolution();
|
|
637
|
+
const enrichment = await loadResourceEnrichmentMap(ctx.solutionDir);
|
|
638
|
+
const localTypes = resourceType ? GET_SEARCHABLE_TYPES.filter((t) => t.type === resourceType) : GET_SEARCHABLE_TYPES;
|
|
639
|
+
const matches = [];
|
|
640
|
+
for (const { type } of localTypes) {
|
|
641
|
+
const locals = await readLocalResourcesForType(ctx, type, enrichment);
|
|
642
|
+
for (const resource of locals) {
|
|
643
|
+
if (resource.entityKey === identifier) {
|
|
644
|
+
matches.push({ resourceType: type, resource });
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
return matches;
|
|
649
|
+
}
|
|
650
|
+
async function getResources(identifier, resourceType, options) {
|
|
651
|
+
if (options?.local) {
|
|
652
|
+
return getLocalResources(identifier, resourceType);
|
|
653
|
+
}
|
|
654
|
+
const typesToSearch = resourceType ? GET_SEARCHABLE_TYPES.filter((t) => t.type === resourceType) : GET_SEARCHABLE_TYPES;
|
|
655
|
+
const settled = await Promise.allSettled(typesToSearch.map(({ type, idField }) => getResourcesWithCacheFallback(type).then((resources) => ({
|
|
656
|
+
type,
|
|
657
|
+
idField,
|
|
658
|
+
resources
|
|
659
|
+
}))));
|
|
660
|
+
const matches = [];
|
|
661
|
+
for (const result of settled) {
|
|
662
|
+
if (result.status !== "fulfilled")
|
|
663
|
+
continue;
|
|
664
|
+
const { type, idField, resources } = result.value;
|
|
665
|
+
for (const resource of resources) {
|
|
666
|
+
if (resource[idField] === identifier) {
|
|
667
|
+
matches.push({ resourceType: type, resource });
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
return matches;
|
|
672
|
+
}
|
|
673
|
+
export {
|
|
674
|
+
getResources,
|
|
675
|
+
listLocalResources,
|
|
676
|
+
listResources,
|
|
677
|
+
pullRemoteResources,
|
|
678
|
+
pullResources,
|
|
679
|
+
searchResources,
|
|
680
|
+
searchResourcesWithFilters
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
//# debugId=E111735BC7C7645664756E2164756E21
|