@uipath/vertical-solutions-tool 1.206.1-preview.301 → 1.207.0-preview.305

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.
Files changed (56) hide show
  1. package/README.md +27 -1
  2. package/dist/THIRD-PARTY-NOTICES.md +32 -1
  3. package/dist/{createSdk-ej6a8h0r.js → createSdk-gpqj9sth.js} +2 -2
  4. package/dist/{deploy-jobs-py2rv4wt.js → deploy-jobs-kz0qq245.js} +4 -4
  5. package/dist/deploy-service-qf7bzhhs.js +879 -0
  6. package/dist/{deployment-search-weqjabxg.js → deployment-search-nx6ts2e7.js} +9 -589
  7. package/dist/index-8wqbe0tq.js +16 -0
  8. package/dist/{index-gj5yvhty.js → index-nnpk3wfj.js} +225 -4
  9. package/dist/{index-fx4b6zvh.js → index-pw8fgsfr.js} +1722 -174
  10. package/dist/index-tcn9340a.js +577 -0
  11. package/dist/{index-1n2qt3mv.js → index-ym3ethxz.js} +1 -1
  12. package/dist/index.js +6 -6
  13. package/dist/{job-commands-wpja9xzt.js → job-commands-4cyjk35d.js} +5 -5
  14. package/dist/{job-output-nc8hndpj.js → job-output-6apb9e0r.js} +2 -2
  15. package/dist/pack-service-60575wb5.js +394 -0
  16. package/dist/package-name-bkwxfe36.js +16 -0
  17. package/dist/packages-5c2q0gf3.js +18 -0
  18. package/dist/{prompts-ycxb43e4.js → prompts-p3csv27m.js} +15 -5
  19. package/dist/resolve-target-mxtcmx7d.js +20 -0
  20. package/dist/{resume-service-b8zvn14v.js → resume-service-aftv2m8e.js} +25 -21
  21. package/dist/{seed-service-d2r0k0fm.js → seed-service-v0wr7qx6.js} +35 -30
  22. package/dist/{seed-templates-rt11me3k.js → seed-templates-mma4eqk3.js} +3 -3
  23. package/dist/{service-errors-gx27teqv.js → service-errors-6ktx1fhk.js} +5 -5
  24. package/dist/{solution-auth-rpegyzgz.js → solution-auth-eejqs9k6.js} +4 -2
  25. package/dist/{solution-deployments-n4wck6cq.js → solution-deployments-ek6rc9p3.js} +2 -2
  26. package/dist/templates-vb1tksdx.js +10 -0
  27. package/dist/tool-0x16rbhg.js +1108 -0
  28. package/dist/{tool-f0jjp878.js → tool-24mpfh95.js} +2 -18
  29. package/dist/{tool-8396478b.js → tool-3jvc8y0w.js} +1 -1
  30. package/dist/{tool-ajmcxdew.js → tool-3myz4zby.js} +12 -6
  31. package/dist/{tool-n4tyjxq8.js → tool-3pt20zyc.js} +12 -308
  32. package/dist/{tool-ebeka3z3.js → tool-44k71kjb.js} +2 -2
  33. package/dist/{tool-w9sqx5pf.js → tool-4te3f5p3.js} +48 -6
  34. package/dist/{tool-yd0xm5m1.js → tool-63kepp09.js} +178 -32
  35. package/dist/{tool-bnvx37at.js → tool-6n8z2dm7.js} +1 -1
  36. package/dist/{tool-p5nf1tfe.js → tool-7yyk32hj.js} +11 -557
  37. package/dist/tool-j2736nrm.js +249 -0
  38. package/dist/{tool-vfg6ctg9.js → tool-j8ahrygt.js} +1 -1
  39. package/dist/{tool-xbfgdtj6.js → tool-jde2etnd.js} +3 -3
  40. package/dist/tool-m148vv6j.js +19 -0
  41. package/dist/{tool-75heeb40.js → tool-n5vnqpft.js} +23 -12
  42. package/dist/tool-n8brc19c.js +64 -0
  43. package/dist/{tool-x2xmgr0n.js → tool-nczkcf4d.js} +2 -2
  44. package/dist/{deploy-service-v6yxhxad.js → tool-pd2jxn5j.js} +36 -895
  45. package/dist/tool-r20zj24f.js +85 -0
  46. package/dist/tool-rgpvazq3.js +600 -0
  47. package/dist/{tool-k26cvj17.js → tool-t3jsnrrv.js} +9 -7
  48. package/dist/{tool-2hzryrk7.js → tool-w6twa5ga.js} +280 -137
  49. package/dist/{tool-k6bb2r5g.js → tool-xvdam87g.js} +19 -9
  50. package/dist/{tool-zec82jd0.js → tool-yxj5jsds.js} +5 -5
  51. package/dist/{tool-7q7wfckv.js → tool-z9kq8fc2.js} +1 -1
  52. package/dist/tool.js +6 -6
  53. package/dist/watch-job-n6atqtbd.js +21 -0
  54. package/package.json +2 -2
  55. package/dist/templates-pnvgqy8a.js +0 -9
  56. package/dist/watch-job-z6wkx8fx.js +0 -21
@@ -0,0 +1,879 @@
1
+ import {
2
+ getFileSystem2,
3
+ catchError,
4
+ RESULTS,
5
+ resolveEnvReference,
6
+ canPrompt
7
+ } from "./tool-w6twa5ga.js";
8
+ import {
9
+ jsonObject,
10
+ VssApiError
11
+ } from "./tool-44k71kjb.js";
12
+ import"./tool-m148vv6j.js";
13
+ import {
14
+ submitDeployJob2
15
+ } from "./tool-3myz4zby.js";
16
+ import"./tool-4te3f5p3.js";
17
+ import {
18
+ failure,
19
+ missingOption,
20
+ invalidOption
21
+ } from "./tool-3jvc8y0w.js";
22
+ import {
23
+ writeProgress2,
24
+ writeWarning2,
25
+ writeStepSummary2,
26
+ writeSuccessSummary2
27
+ } from "./tool-j8ahrygt.js";
28
+ import {
29
+ configKeyProblem
30
+ } from "./tool-j2736nrm.js";
31
+ import {
32
+ resolveDeployTarget2
33
+ } from "./tool-pd2jxn5j.js";
34
+ import"./tool-yxj5jsds.js";
35
+ import {
36
+ toDeployFailure2
37
+ } from "./tool-t3jsnrrv.js";
38
+ import"./tool-n8brc19c.js";
39
+ import"./tool-3pt20zyc.js";
40
+ import {
41
+ describePauseKind,
42
+ pauseInstructions,
43
+ pauseErrorCode,
44
+ rejectSeedWithoutWait,
45
+ finalizeSucceededJob,
46
+ stoppedWatching
47
+ } from "./tool-n5vnqpft.js";
48
+ import {
49
+ withCapacityRetry,
50
+ watchOptionsFrom2,
51
+ watchDeployJob2
52
+ } from "./tool-xvdam87g.js";
53
+ import {
54
+ rejectBlankOptions,
55
+ readServiceUrl2,
56
+ credentialsFailure2
57
+ } from "./tool-jde2etnd.js";
58
+ import"./tool-r20zj24f.js";
59
+ import {
60
+ createVssConfig
61
+ } from "./tool-nczkcf4d.js";
62
+ import {
63
+ checkBeforeResubmitting,
64
+ routingFlags
65
+ } from "./tool-8na6g90k.js";
66
+ import {
67
+ forDisplay,
68
+ forDisplayIfSet
69
+ } from "./tool-fbthdwqc.js";
70
+ import {
71
+ string,
72
+ unknown,
73
+ array,
74
+ looseObject
75
+ } from "./tool-24mpfh95.js";
76
+
77
+ // src/services/manifest-configurations.ts
78
+ var SECRET_TERMS = [
79
+ "secret",
80
+ "password",
81
+ "passwd",
82
+ "pwd",
83
+ "token",
84
+ "credential",
85
+ "apikey",
86
+ "api-key",
87
+ "api_key",
88
+ "accesskey",
89
+ "access-key",
90
+ "access_key",
91
+ "privatekey",
92
+ "private-key",
93
+ "private_key",
94
+ "connectionstring",
95
+ "connection-string",
96
+ "connection_string",
97
+ "passphrase"
98
+ ];
99
+ function looksSecret(key) {
100
+ return secretTermIn(key) !== undefined;
101
+ }
102
+ function secretTermIn(key) {
103
+ const lower = key.toLowerCase();
104
+ return SECRET_TERMS.find((term) => lower.includes(term));
105
+ }
106
+ function parseConfigPairs(pairs) {
107
+ const entries = [];
108
+ const literalSecretKeys = [];
109
+ for (const [index, pair] of pairs.entries()) {
110
+ const separator = pair.indexOf("=");
111
+ if (separator < 0) {
112
+ throw new Error(`Invalid --config value #${index + 1}: expected KEY=VALUE, but there is no '='.`);
113
+ }
114
+ const key = pair.slice(0, separator).trim();
115
+ const raw = pair.slice(separator + 1);
116
+ if (!key) {
117
+ throw new Error(`Invalid --config value #${index + 1}: the key before '=' is empty.`);
118
+ }
119
+ const problem = configKeyProblem(key);
120
+ if (problem) {
121
+ throw new Error(`Invalid --config value #${index + 1}: ${problem}`);
122
+ }
123
+ const isEnvReference = raw.startsWith("env.");
124
+ if (!isEnvReference && looksSecret(key)) {
125
+ literalSecretKeys.push(key);
126
+ }
127
+ entries.push({ key, value: raw });
128
+ }
129
+ return { entries, literalSecretKeys };
130
+ }
131
+ function normalizeConfigFileValues(parsed, path) {
132
+ const document = jsonObject.safeParse(parsed);
133
+ if (!document.success) {
134
+ throw new TypeError(`${path} must contain a JSON/YAML object of KEY: VALUE pairs.`);
135
+ }
136
+ const entries = [];
137
+ const literalSecretKeys = [];
138
+ for (const [key, raw] of Object.entries(document.data)) {
139
+ const problem = configKeyProblem(key);
140
+ if (problem)
141
+ throw new Error(`${path}: ${problem}`);
142
+ const value = string().safeParse(raw);
143
+ if (!value.success) {
144
+ throw new TypeError(`${path}: the value of "${key}" must be a string.`);
145
+ }
146
+ if (!value.data.startsWith("env.") && looksSecret(key)) {
147
+ literalSecretKeys.push(key);
148
+ }
149
+ entries.push({ key, value: value.data });
150
+ }
151
+ return { entries, literalSecretKeys };
152
+ }
153
+ function mergeConfigurations(fileEntries, flagEntries) {
154
+ const merged = Object.create(null);
155
+ for (const entry of [...fileEntries, ...flagEntries]) {
156
+ merged[entry.key] = entry.value;
157
+ }
158
+ for (const key of Object.keys(merged)) {
159
+ const [error, value] = catchError(() => resolveEnvReference(merged[key]));
160
+ if (error || value === undefined) {
161
+ throw new Error(`Configuration ${key}: ${error?.message ?? "could not be read"}.`);
162
+ }
163
+ merged[key] = value;
164
+ }
165
+ return merged;
166
+ }
167
+
168
+ // src/services/collect-configurations.ts
169
+ var NOTHING_DECLARED = new Map;
170
+ async function collectConfigurations(manifest, options, prompts) {
171
+ const warnings = [];
172
+ const fromFile = await readConfigFile(options.configFile);
173
+ if (!fromFile.ok)
174
+ return fromFile;
175
+ const [parseError, parsed] = catchError(() => parseConfigPairs(options.config ?? []));
176
+ if (parseError || !parsed) {
177
+ return invalidOption(parseError?.message ?? "Could not read --config.", "Use --config KEY=VALUE, and --config KEY=env.MY_VAR for a secret.");
178
+ }
179
+ for (const key of parsed.literalSecretKeys) {
180
+ warnings.push(`'${key}' was given a literal value on the command line, where it lands in ` + `shell history, 'ps' output and CI logs. Prefer --config ${key}=env.MY_VAR.`);
181
+ }
182
+ for (const key of fromFile.literalSecretKeys) {
183
+ warnings.push(`'${key}' has a literal value in ${options.configFile ?? "the config file"}, which is ` + `usually committed. Prefer ${key}: env.MY_VAR and keep the secret in the environment.`);
184
+ }
185
+ const [mergeError, configurations] = catchError(() => mergeConfigurations(fromFile.entries, parsed.entries));
186
+ if (mergeError || !configurations) {
187
+ return invalidOption(mergeError?.message ?? "Could not read the configuration values.", "Set the environment variable, or pass the value with --config KEY=VALUE.");
188
+ }
189
+ const declared = manifest.configurations ?? NOTHING_DECLARED;
190
+ warnings.push(...undeclaredKeys(declared, configurations));
191
+ const missing = missingRequiredKeys(declared, configurations);
192
+ const badDeclaration = reservedDeclaration(missing);
193
+ if (badDeclaration)
194
+ return badDeclaration;
195
+ if (missing.length === 0) {
196
+ return { ok: true, configurations, warnings };
197
+ }
198
+ if (!canPrompt()) {
199
+ return missingOption(`Configuration for ${missing.join(", ")}`, `--config ${missing[0]}=<value> (or --config ${missing[0]}=env.MY_VAR for a secret)`);
200
+ }
201
+ for (const key of missing) {
202
+ const value = await promptRequired(key, declared.get(key), prompts);
203
+ if (value === undefined) {
204
+ return missingOption(`A value for ${key}`, `--config ${key}=<value> (or --config ${key}=env.MY_VAR for a secret)`);
205
+ }
206
+ configurations[key] = value;
207
+ }
208
+ return { ok: true, configurations, warnings };
209
+ }
210
+ var MAX_PROMPT_ATTEMPTS = 10;
211
+ async function promptRequired(key, meta, prompts) {
212
+ for (let attempt = 0;attempt < MAX_PROMPT_ATTEMPTS; attempt += 1) {
213
+ const entered = await prompts.askValue(key, {
214
+ description: meta?.description,
215
+ defaultValue: meta?.value,
216
+ secret: meta?.isSecret || secretTermIn(key) !== undefined
217
+ });
218
+ const trimmed = entered?.trim();
219
+ if (trimmed)
220
+ return trimmed;
221
+ writeWarning2(`A value for ${key} is required.`);
222
+ }
223
+ return;
224
+ }
225
+ async function readConfigFile(path) {
226
+ if (path === undefined) {
227
+ return { ok: true, entries: [], literalSecretKeys: [] };
228
+ }
229
+ const fs = getFileSystem2();
230
+ if (!await fs.exists(path)) {
231
+ return failure("invalid-option", `--config-file not found: ${path}`, "Check the path, or drop the flag and pass values with --config KEY=VALUE.");
232
+ }
233
+ const [readError, contents] = await catchError(fs.readFile(path, "utf-8"));
234
+ if (readError || contents === null) {
235
+ return failure("invalid-option", `Failed to read ${path}: ${readError?.message ?? "the file is empty"}`, "Check the file is readable, or drop --config-file and pass values with " + "--config KEY=VALUE.");
236
+ }
237
+ const [parseError, parsed] = catchError(() => parseConfigDocument(contents));
238
+ if (parseError || parsed === undefined) {
239
+ return failure("invalid-option", `${path} is not valid JSON or YAML: ${parseError?.message ?? "unknown error"}`, "Fix the file so it parses as a JSON or YAML object of KEY: VALUE pairs.");
240
+ }
241
+ const [normalizeError, values] = catchError(() => normalizeConfigFileValues(parsed, path));
242
+ if (normalizeError || !values) {
243
+ return failure("invalid-option", normalizeError?.message ?? `Could not read ${path}.`, "Fix the file: a flat JSON or YAML object of KEY: VALUE pairs, string values only.");
244
+ }
245
+ return { ok: true, ...values };
246
+ }
247
+ function parseConfigDocument(contents) {
248
+ const trimmed = contents.trim();
249
+ if (trimmed === "")
250
+ throw new Error("the file is empty");
251
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
252
+ return JSON.parse(trimmed);
253
+ }
254
+ const [jsonError, json] = catchError(() => JSON.parse(trimmed));
255
+ if (!jsonError)
256
+ return json;
257
+ return parseFlatYaml(trimmed);
258
+ }
259
+ function parseFlatYaml(trimmed) {
260
+ const result = Object.create(null);
261
+ for (const [index, rawLine] of trimmed.split(/\r?\n/).entries()) {
262
+ const line = rawLine.trim();
263
+ if (line === "" || line.startsWith("#"))
264
+ continue;
265
+ if (/^[ \t]/.test(rawLine)) {
266
+ throw new Error(`line ${index + 1}: nested values are not supported — write one flat "key: value" per line`);
267
+ }
268
+ const separator = line.indexOf(":");
269
+ if (separator <= 0) {
270
+ throw new Error(`line ${index + 1}: expected "key: value"`);
271
+ }
272
+ const key = line.slice(0, separator).trim();
273
+ const problem = configKeyProblem(key);
274
+ if (problem)
275
+ throw new Error(`line ${index + 1}: ${problem}`);
276
+ const raw = line.slice(separator + 1).trim();
277
+ if (raw === "") {
278
+ throw new Error(`line ${index + 1}: "${key}" has no value — write \`${key}: ""\` for an empty ` + 'one, or flatten a nested block into one "key: value" per line');
279
+ }
280
+ result[key] = raw.replace(/^["'](.*)["']$/, "$1");
281
+ }
282
+ return result;
283
+ }
284
+ var DEPLOY_SET_KEYS = new Set([
285
+ "UIPATH_BASE_URL",
286
+ "UIPATH_ORG_ID",
287
+ "UIPATH_ORG_NAME",
288
+ "UIPATH_TENANT_ID",
289
+ "UIPATH_TENANT_NAME",
290
+ "UIPATH_FOLDER_KEY",
291
+ "UIPATH_FOLDER_ID",
292
+ "UIPATH_FOLDER_PATH"
293
+ ]);
294
+ function undeclaredKeys(declared, configurations) {
295
+ return Object.keys(configurations).flatMap((key) => {
296
+ if (DEPLOY_SET_KEYS.has(key)) {
297
+ return [
298
+ `${key} is set by the deploy itself, which takes precedence over this value.`
299
+ ];
300
+ }
301
+ return declared.size === 0 || declared.has(key) ? [] : [
302
+ `${key} is not a configuration this package declares, so nothing reads it.`
303
+ ];
304
+ });
305
+ }
306
+ function reservedDeclaration(missing) {
307
+ for (const key of missing) {
308
+ const problem = configKeyProblem(key);
309
+ if (problem) {
310
+ return invalidOption(`The package manifest declares a configuration it cannot take: ${problem}`, "Fix the configuration keys in the package manifest and publish it again.");
311
+ }
312
+ }
313
+ return;
314
+ }
315
+ function missingRequiredKeys(declared, collected) {
316
+ return [...declared].filter(([key, meta]) => meta.isRequired && (!Object.hasOwn(collected, key) || collected[key].trim() === "")).map(([key]) => key);
317
+ }
318
+
319
+ // src/services/deploy-config.ts
320
+ var CAPS = {
321
+ maxResources: 20,
322
+ maxPropertiesPerResource: 20,
323
+ maxKeyLength: 100,
324
+ maxValueLength: 1024,
325
+ maxNameLength: 200
326
+ };
327
+ var ROUTING_NAME_PATTERN = /^[a-z0-9][a-z0-9-]{0,31}$/;
328
+ var ROUTING_NAME_RULE = "a routing name must be lowercase letters, digits and hyphens, at most 32 characters";
329
+ var DeployConfigDocumentSchema = looseObject({
330
+ version: unknown().optional(),
331
+ externalApp: unknown().optional(),
332
+ resources: unknown().optional()
333
+ });
334
+ var DeployConfigResourceSchema = looseObject({
335
+ name: string().optional(),
336
+ kind: string().optional(),
337
+ configuration: jsonObject.nullish()
338
+ });
339
+ async function discoverDeployConfig(explicitPath) {
340
+ const fs = getFileSystem2();
341
+ if (explicitPath !== undefined) {
342
+ if (!await fs.exists(explicitPath)) {
343
+ throw new Error(`--resource-config file not found: ${explicitPath}`);
344
+ }
345
+ return explicitPath;
346
+ }
347
+ const candidate = fs.path.join(fs.env.cwd(), "deploy-config.json");
348
+ return await fs.exists(candidate) ? candidate : undefined;
349
+ }
350
+ function describeValue(value) {
351
+ if (typeof value === "object" && value !== null) {
352
+ return Array.isArray(value) ? "an array" : "an object";
353
+ }
354
+ const text = JSON.stringify(value) ?? String(value);
355
+ return text.length > 40 ? `${text.slice(0, 40)}…` : text;
356
+ }
357
+ async function loadDeployConfig(path) {
358
+ const fs = getFileSystem2();
359
+ const [readError, contents] = await catchError(fs.readFile(path, "utf-8"));
360
+ if (readError || contents === null) {
361
+ throw new Error(`Failed to read ${path}: ${readError?.message ?? "the file is empty"}`);
362
+ }
363
+ const [parseError, json] = catchError(() => JSON.parse(contents));
364
+ const document = DeployConfigDocumentSchema.safeParse(json);
365
+ if (parseError || !document.success) {
366
+ throw new Error(`${path} is not valid JSON: ${parseError?.message ?? "it must be a JSON object"}`);
367
+ }
368
+ const { version, externalApp, resources } = document.data;
369
+ const warnings = [];
370
+ if (version !== undefined && version !== 1) {
371
+ throw new Error(`${path}: unsupported version ${describeValue(version)} — only 1 is supported.`);
372
+ }
373
+ if (externalApp !== undefined) {
374
+ warnings.push(`${path}: the 'externalApp' block is ignored — external-app auto-creation was removed. ` + "Register the application yourself and supply its id as 'externalClientId'.");
375
+ }
376
+ const entries = array(unknown()).safeParse(resources);
377
+ if (!entries.success) {
378
+ throw new TypeError(`${path}: 'resources' must be an array.`);
379
+ }
380
+ return {
381
+ path,
382
+ resources: entries.data.map((entry, index) => parseResource(entry, index, path)),
383
+ warnings
384
+ };
385
+ }
386
+ function parseResource(entry, index, path) {
387
+ const parsed = DeployConfigResourceSchema.safeParse(entry);
388
+ if (!parsed.success) {
389
+ throw resourceError(parsed.error.issues[0]?.path[0], index, path);
390
+ }
391
+ const configuration = {};
392
+ for (const [key, value] of Object.entries(parsed.data.configuration ?? {})) {
393
+ configuration[key] = parseConfigurationEntry(key, value, path);
394
+ }
395
+ return { ...parsed.data, configuration };
396
+ }
397
+ function resourceError(field, index, path) {
398
+ if (field === "name") {
399
+ return new Error(`${path}: 'name' must be a string when present.`);
400
+ }
401
+ if (field === "kind") {
402
+ return new Error(`${path}: 'kind' must be a string when present.`);
403
+ }
404
+ if (field === "configuration") {
405
+ return new Error(`${path}: 'configuration' must be an object.`);
406
+ }
407
+ return new TypeError(`${path}: 'resources[${index}]' must be an object with 'name', 'kind' and 'configuration'.`);
408
+ }
409
+ function parseConfigurationEntry(key, value, path) {
410
+ const reserved = configKeyProblem(key);
411
+ if (reserved) {
412
+ throw new Error(`${path}: ${reserved}`);
413
+ }
414
+ const forbidden = secretTermIn(key);
415
+ if (forbidden) {
416
+ throw new Error(`${path}: '${key}' looks like a secret (contains "${forbidden}"). ` + "This file is meant to be committed and its values are stored unencrypted — " + "pass secret values with --config KEY=env.VAR instead.");
417
+ }
418
+ const text = string().safeParse(value);
419
+ if (!text.success) {
420
+ throw new TypeError(`${path}: the value of '${key}' must be a string.`);
421
+ }
422
+ if (key === "routingName" && !ROUTING_NAME_PATTERN.test(text.data)) {
423
+ throw new Error(`${path}: 'routingName' is not valid — ${ROUTING_NAME_RULE}.`);
424
+ }
425
+ return text.data;
426
+ }
427
+
428
+ // src/services/resource-payload.ts
429
+ function buildPayload(resolved, displayNames, warnings) {
430
+ const payload = [];
431
+ for (const [key, values] of resolved) {
432
+ const name = displayNames.get(key) ?? key;
433
+ if (name.length > CAPS.maxNameLength) {
434
+ warnings.push(`Skipping resource '${name.slice(0, 40)}…': the name exceeds ${CAPS.maxNameLength} characters.`);
435
+ continue;
436
+ }
437
+ const configuration = buildResourceConfiguration(name, values, warnings);
438
+ if (Object.keys(configuration).length === 0)
439
+ continue;
440
+ if (payload.length >= CAPS.maxResources) {
441
+ warnings.push(`Dropping resource '${name}': at most ${CAPS.maxResources} resources may be configured.`);
442
+ continue;
443
+ }
444
+ payload.push({ name, configuration });
445
+ }
446
+ return payload;
447
+ }
448
+ function buildResourceConfiguration(name, values, warnings) {
449
+ const configuration = {};
450
+ for (const [property, value] of values) {
451
+ const dropReason = propertyDropReason(property, value, Object.keys(configuration).length);
452
+ if (dropReason !== undefined) {
453
+ warnings.push(`Dropping '${name}.${property}': ${dropReason}`);
454
+ continue;
455
+ }
456
+ configuration[property] = value;
457
+ }
458
+ return configuration;
459
+ }
460
+ function propertyDropReason(property, value, keptSoFar) {
461
+ if (property.length > CAPS.maxKeyLength) {
462
+ return `the property name exceeds ${CAPS.maxKeyLength} characters.`;
463
+ }
464
+ if (value.length > CAPS.maxValueLength) {
465
+ return `the value exceeds ${CAPS.maxValueLength} characters.`;
466
+ }
467
+ if (property === "routingName" && !ROUTING_NAME_PATTERN.test(value)) {
468
+ return `${ROUTING_NAME_RULE}. The deployment will pause for it instead.`;
469
+ }
470
+ if (keptSoFar >= CAPS.maxPropertiesPerResource) {
471
+ return `a resource may carry at most ${CAPS.maxPropertiesPerResource} properties.`;
472
+ }
473
+ return;
474
+ }
475
+
476
+ // src/services/declared-configuration.ts
477
+ function validateRoutingNameAnswer(value) {
478
+ const trimmed = value.trim();
479
+ if (trimmed === "" || ROUTING_NAME_PATTERN.test(trimmed))
480
+ return true;
481
+ return `${ROUTING_NAME_RULE[0].toUpperCase()}${ROUTING_NAME_RULE.slice(1)}.`;
482
+ }
483
+ var NOTHING_DECLARED2 = { properties: [], warnings: [] };
484
+ function parseDeclaredConfiguration(manifest) {
485
+ return manifest.solution?.configuration ?? NOTHING_DECLARED2;
486
+ }
487
+ async function collectDeclaredConfiguration(input) {
488
+ const declaration = parseDeclaredConfiguration(input.manifest);
489
+ const warnings = [...declaration.warnings, ...input.file?.warnings ?? []];
490
+ const { resolved, displayNames, fromFile } = seedFromFile(input, declaration, warnings);
491
+ const unresolvedRequired = [];
492
+ const unresolvedOnUpgrade = [];
493
+ for (const property of declaration.properties) {
494
+ const key = property.resourceName.toLowerCase();
495
+ const values = resolved.get(key) ?? new Map;
496
+ if (!displayNames.has(key)) {
497
+ displayNames.set(key, property.resourceName);
498
+ }
499
+ const before = unresolvedRequired.length;
500
+ await resolveDeclaredProperty(property, values, input, warnings, unresolvedRequired);
501
+ if (unresolvedRequired.length > before && property.askOnUpgrade) {
502
+ unresolvedOnUpgrade.push(property);
503
+ }
504
+ resolved.set(key, values);
505
+ }
506
+ if (input.isFreshInstall) {
507
+ warnUnresolvedRequired(declaration.properties, unresolvedRequired, warnings);
508
+ } else {
509
+ warnNotRetained(unresolvedOnUpgrade, warnings);
510
+ }
511
+ const payload = buildPayload(resolved, displayNames, warnings);
512
+ return { payload, warnings, unresolvedRequired, fromFile };
513
+ }
514
+ function seedFromFile(input, declaration, warnings) {
515
+ const resolved = new Map;
516
+ const displayNames = new Map;
517
+ const fromFile = new Map;
518
+ const declared = new Set(declaration.properties.map((property) => property.resourceName.toLowerCase()));
519
+ for (const resource of input.file?.resources ?? []) {
520
+ const name = resolveFileResourceName(resource, input, declaration);
521
+ if (name === undefined) {
522
+ warnings.push("Skipping a deploy-config entry with no 'name': the manifest does not declare " + "exactly one configurable resource, so the name cannot be inferred.");
523
+ continue;
524
+ }
525
+ const key = name.toLowerCase();
526
+ if (declared.size > 0 && !declared.has(key)) {
527
+ warnings.push(`deploy-config names resource '${name}', which this solution's ` + "manifest does not declare as configurable — the entry is ignored.");
528
+ continue;
529
+ }
530
+ displayNames.set(key, name);
531
+ const values = resolved.get(key) ?? new Map;
532
+ const supplied = fromFile.get(key) ?? new Set;
533
+ for (const [property, value] of Object.entries(resource.configuration ?? {})) {
534
+ if (value.trim() === "")
535
+ continue;
536
+ values.set(property, value);
537
+ supplied.add(property);
538
+ }
539
+ resolved.set(key, values);
540
+ fromFile.set(key, supplied);
541
+ }
542
+ return { resolved, displayNames, fromFile };
543
+ }
544
+ async function resolveDeclaredProperty(property, values, input, warnings, unresolvedRequired) {
545
+ const secretTerm = secretTermIn(property.propertyName);
546
+ if (secretTerm) {
547
+ values.delete(property.propertyName);
548
+ warnings.push(`Skipping ${property.resourceName}.${property.propertyName}: its name contains ` + `'${secretTerm}', and per-resource values are stored unencrypted on the deploy ` + "job. Set it in the portal's configuration wizard instead.");
549
+ return;
550
+ }
551
+ if (values.has(property.propertyName))
552
+ return;
553
+ if (property.hasManifestValue)
554
+ return;
555
+ const typed = await askFor(property, input);
556
+ if (typed !== undefined && typed !== "") {
557
+ values.set(property.propertyName, typed);
558
+ } else if (property.required) {
559
+ unresolvedRequired.push(`${property.resourceName}.${property.propertyName}`);
560
+ }
561
+ }
562
+ function warnUnresolvedRequired(declared, unresolvedRequired, warnings) {
563
+ const linkFolders = new Set(declared.filter((property) => property.isLinkFolder).map((property) => labelOf(property)));
564
+ for (const label of unresolvedRequired) {
565
+ warnings.push(linkFolders.has(label) ? `${label} is declared required by the package but no value was supplied — ` + "the deployment will fail rather than install its own copy of the resource " + "it should link to. Set the folder in deploy-config.json." : `${label} is declared required by the package but no value was supplied — ` + "the deployment will pause and offer the portal's configuration wizard for it. " + "Set it in deploy-config.json to deploy without stopping.");
566
+ }
567
+ }
568
+ function warnNotRetained(unresolved, warnings) {
569
+ for (const property of unresolved) {
570
+ const label = labelOf(property);
571
+ warnings.push(property.isLinkFolder ? `${label} is not kept on an upgrade (retainOnUpgrade: false) and no value was ` + "supplied — the upgrade will fail. Set the folder in deploy-config.json." : `${label} is not kept on an upgrade (retainOnUpgrade: false) and no value was ` + "supplied — the deployment keeps its current value. Set it in " + "deploy-config.json to change it.");
572
+ }
573
+ }
574
+ function labelOf(property) {
575
+ return `${property.resourceName}.${property.propertyName}`;
576
+ }
577
+ async function askFor(property, input) {
578
+ const asks = input.isFreshInstall || property.askOnUpgrade;
579
+ if (!asks || !canPrompt())
580
+ return;
581
+ const typed = await input.prompts.askValue(`${property.resourceName}.${property.propertyName}`, {
582
+ description: property.description,
583
+ defaultValue: property.defaultValue,
584
+ secret: false,
585
+ ...property.propertyName === "routingName" ? { validate: validateRoutingNameAnswer } : {}
586
+ });
587
+ return typed?.trim();
588
+ }
589
+ function resolveFileResourceName(resource, input, declaration) {
590
+ if (resource.name)
591
+ return resource.name;
592
+ const declaredNames = new Set(declaration.properties.map((property) => property.resourceName));
593
+ if (input.file?.resources.length === 1 && declaredNames.size === 1) {
594
+ return [...declaredNames][0];
595
+ }
596
+ return;
597
+ }
598
+
599
+ // src/services/manifest-preflight.ts
600
+ function hasEntries(section) {
601
+ return Object.keys(section ?? {}).length > 0;
602
+ }
603
+ function findTenantResources(manifest) {
604
+ const findings = [];
605
+ if (manifest.dataFabric?.schemaFilename) {
606
+ findings.push({
607
+ step: "DF_SCHEMA",
608
+ manifestKey: "dataFabric.schemaFilename",
609
+ describe: "a Data Fabric entity schema to import"
610
+ });
611
+ }
612
+ if (manifest.ixp) {
613
+ findings.push({
614
+ step: "IXP",
615
+ manifestKey: "ixp",
616
+ describe: "an IXP project, taxonomy and ML models"
617
+ });
618
+ }
619
+ if (hasEntries(manifest.storageBuckets)) {
620
+ findings.push({
621
+ step: "TOP_BUCKETS",
622
+ manifestKey: "storageBuckets",
623
+ describe: "tenant-level storage buckets"
624
+ });
625
+ }
626
+ if (hasEntries(manifest.indexes)) {
627
+ findings.push({
628
+ step: "TOP_INDEXES",
629
+ manifestKey: "indexes",
630
+ describe: "tenant-level context-grounding indexes"
631
+ });
632
+ }
633
+ if (manifest.webapp) {
634
+ findings.push({
635
+ step: "WEBAPP",
636
+ manifestKey: "webapp",
637
+ describe: "a web application to register and publish"
638
+ });
639
+ }
640
+ return findings;
641
+ }
642
+ function describeTenantResources(findings) {
643
+ return findings.map((f) => ` - ${f.manifestKey} (${f.describe}) — step ${f.step}`).join(`
644
+ `);
645
+ }
646
+
647
+ // src/services/deploy/prepare-submit.ts
648
+ async function prepareSubmit(config, options, deps) {
649
+ const target = await resolveDeployTarget2(config, options, deps.target);
650
+ if (!target.ok)
651
+ return target;
652
+ const tenantResources = findTenantResources(target.manifest);
653
+ if (tenantResources.length > 0) {
654
+ return failure("tenant-resources-declared", `${target.packageName} ${target.packageVersion} provisions tenant-level resources, ` + `which 'uip vss deploy' does not deploy:
655
+ ` + describeTenantResources(tenantResources), "Deploying it here would leave those resources unprovisioned while reporting success. " + "Use the vertical-deploy-cli for this package until tenant-level resources are supported.");
656
+ }
657
+ const collected = await collectConfigurations(target.manifest, { config: options.config, configFile: options.configFile }, deps.configuration);
658
+ if (!collected.ok)
659
+ return collected;
660
+ for (const warning of collected.warnings)
661
+ writeWarning2(warning);
662
+ const resourceConfigurations = await buildDeployConfigPayload(options, target.manifest, target.action === "install", deps);
663
+ if (!resourceConfigurations.ok)
664
+ return resourceConfigurations;
665
+ const request = {
666
+ packageName: target.packageName,
667
+ packageVersion: target.packageVersion,
668
+ action: target.action,
669
+ target: target.target
670
+ };
671
+ if (Object.keys(collected.configurations).length > 0) {
672
+ request.configurations = collected.configurations;
673
+ }
674
+ if (resourceConfigurations.value.payload.length > 0) {
675
+ request.resourceConfigurations = resourceConfigurations.value.payload;
676
+ }
677
+ if (target.deploymentName)
678
+ request.deploymentName = target.deploymentName;
679
+ addIdentityFields(request, config);
680
+ return {
681
+ ok: true,
682
+ request,
683
+ manifest: target.manifest,
684
+ targetLabel: target.targetLabel,
685
+ resources: resourceConfigurations.value.sources
686
+ };
687
+ }
688
+ function addIdentityFields(request, config) {
689
+ if (config.actor)
690
+ request.uploadedBy = config.actor;
691
+ if (config.organizationName) {
692
+ request.organizationName = config.organizationName;
693
+ }
694
+ if (config.tenantName)
695
+ request.tenantName = config.tenantName;
696
+ if (!config.sendScopeIds)
697
+ return;
698
+ if (config.organizationId)
699
+ request.organizationId = config.organizationId;
700
+ if (config.tenantId)
701
+ request.tenantId = config.tenantId;
702
+ }
703
+ async function buildDeployConfigPayload(options, manifest, isFreshInstall, deps) {
704
+ const [discoverError, path] = await catchError(discoverDeployConfig(options.resourceConfig));
705
+ if (discoverError) {
706
+ return invalidOption(discoverError.message, "Check the path, or drop --resource-config to use ./deploy-config.json when it exists.");
707
+ }
708
+ let file;
709
+ if (path !== undefined) {
710
+ const [loadError, loaded] = await catchError(loadDeployConfig(path));
711
+ if (loadError || !loaded) {
712
+ return invalidOption(loadError?.message ?? `Could not read ${path}.`, "Fix the file, or point --resource-config at a different one.");
713
+ }
714
+ file = loaded;
715
+ }
716
+ const collected = await collectDeclaredConfiguration({
717
+ manifest,
718
+ file,
719
+ isFreshInstall,
720
+ prompts: deps.configuration
721
+ });
722
+ for (const warning of collected.warnings)
723
+ writeWarning2(warning);
724
+ return {
725
+ ok: true,
726
+ value: {
727
+ payload: collected.payload,
728
+ sources: { path: file?.path, fromFile: collected.fromFile }
729
+ }
730
+ };
731
+ }
732
+ function summarize(prepared) {
733
+ const { request, targetLabel, resources } = prepared;
734
+ const configured = Object.keys(request.configurations ?? {});
735
+ const lines = [
736
+ `Package: ${request.packageName} ${request.packageVersion}`,
737
+ `Action: ${request.action ?? "install"}`,
738
+ `Target: folder "${targetLabel}"`
739
+ ];
740
+ if (request.deploymentName) {
741
+ lines.push(`Name: ${request.deploymentName}`);
742
+ }
743
+ if (configured.length > 0) {
744
+ lines.push(`Config: ${configured.join(", ")}`);
745
+ }
746
+ for (const resource of request.resourceConfigurations ?? []) {
747
+ const supplied = resources.fromFile.get(resource.name.toLowerCase()) ?? new Set;
748
+ const keys = Object.keys(resource.configuration);
749
+ const fromFile = keys.filter((key) => supplied.has(key));
750
+ let source = "";
751
+ if (resources.path && fromFile.length === keys.length) {
752
+ source = ` (from ${resources.path})`;
753
+ } else if (resources.path && fromFile.length > 0) {
754
+ source = ` (${fromFile.join(", ")} from ${resources.path}; the rest typed)`;
755
+ }
756
+ lines.push(`Resource: ${resource.name}: ${keys.join(", ")}${source}`);
757
+ }
758
+ return lines.join(`
759
+ `);
760
+ }
761
+
762
+ // src/services/deploy/watch-to-completion.ts
763
+ async function watchToCompletion(config, job, options, deps, submitted) {
764
+ const { serviceUrl, manifest, sentResourceConfigurations, deploymentName } = submitted;
765
+ const routing = routingFlags(options);
766
+ const outcome = await watchDeployJob2(watchOptionsFrom2(options, {
767
+ jobId: job.id,
768
+ config,
769
+ serviceUrl,
770
+ prompt: deps.watch,
771
+ sentResourceConfigurations
772
+ }));
773
+ switch (outcome.kind) {
774
+ case "detached":
775
+ case "timeout":
776
+ case "lost-contact":
777
+ return stoppedWatching(outcome, job.id, options.timeout, options);
778
+ case "succeeded": {
779
+ writeSuccessSummary2(outcome.job, outcome.lastLogMessage);
780
+ const [extraError, extra] = await catchError(finalizeSucceededJob({
781
+ config: outcome.config ?? config,
782
+ job: outcome.job,
783
+ deploymentName,
784
+ manifest,
785
+ options,
786
+ deps,
787
+ serviceUrl
788
+ }));
789
+ if (extraError) {
790
+ writeWarning2(`The deploy succeeded. Preparing the seed workspace afterwards failed ` + `(${extraError.message}), so nothing was seeded: run 'uip vss deploy seed' ` + "when you are ready.");
791
+ }
792
+ return {
793
+ ok: true,
794
+ outcome: "succeeded",
795
+ job: outcome.job,
796
+ failedSteps: outcome.failedSteps,
797
+ ...extra ?? {}
798
+ };
799
+ }
800
+ case "paused":
801
+ return failure("job-paused", `Job ${job.id} is paused: it needs ${describePauseKind(outcome.actionKind)}.` + (outcome.message ? `
802
+ ${forDisplay(outcome.message)}` : "") + (outcome.url ? `
803
+ ${forDisplay(outcome.url)}` : ""), pauseInstructions(outcome.actionKind, `uip vss deploy resume ${job.id}${routing}`), { errorCode: pauseErrorCode(outcome.actionKind) });
804
+ case "failed":
805
+ return failure("job-failed", `Job ${job.id} failed` + (outcome.job.error?.step ? ` at step ${forDisplay(outcome.job.error.step)}` : "") + `: ${forDisplayIfSet(outcome.job.error?.message) ?? "unknown error"}`, `The job is checkpointed. Retry from the last successful step with: uip vss deploy resume ${job.id}${routing}`);
806
+ case "canceled":
807
+ writeProgress2(`
808
+ Deployment canceled.`);
809
+ writeStepSummary2(outcome.job);
810
+ return failure("job-canceled", `Job ${job.id} was canceled.`, `Start again with a new deploy, or inspect it with: uip vss deploy status ${job.id}${routing}`);
811
+ case "rejected":
812
+ return toDeployFailure2(outcome.error, `Could not ${outcome.attempting ?? "read"} job ${job.id}`, {
813
+ notFound: "job",
814
+ attempting: outcome.attempting ?? "read",
815
+ jobId: job.id,
816
+ routing: options
817
+ });
818
+ }
819
+ }
820
+
821
+ // src/services/deploy-service.ts
822
+ async function runDeploy(options, deps) {
823
+ const blank = rejectBlankOptions(options);
824
+ if (blank)
825
+ return blank;
826
+ const serviceUrl = readServiceUrl2(options.serviceUrl, options.tenant);
827
+ if (!serviceUrl.ok)
828
+ return serviceUrl;
829
+ const seedWithoutWait = rejectSeedWithoutWait(options);
830
+ if (seedWithoutWait)
831
+ return seedWithoutWait;
832
+ const [authError, config] = await catchError(createVssConfig({
833
+ tenant: options.tenant,
834
+ loginValidity: options.loginValidity,
835
+ serviceUrl: serviceUrl.value
836
+ }));
837
+ if (authError || !config)
838
+ return credentialsFailure2(authError);
839
+ const prepared = await prepareSubmit(config, options, deps);
840
+ if (!prepared.ok)
841
+ return prepared;
842
+ const { request, manifest } = prepared;
843
+ if (options.yes !== true) {
844
+ if (!canPrompt()) {
845
+ return failure("missing-option", "Confirmation is required before a deploy runs.", "Re-run with --yes to confirm, or run from an interactive terminal to be asked.", {
846
+ result: RESULTS.ValidationError,
847
+ errorCode: "invalid_argument"
848
+ });
849
+ }
850
+ if (!await deps.confirmProceed(summarize(prepared))) {
851
+ return failure("declined", "Deploy canceled before submitting.", "Nothing was sent to the service. Run the command again when the " + "summary is what you want, or pass --yes to skip this question.");
852
+ }
853
+ }
854
+ const [submitError, job] = await catchError(withCapacityRetry(() => submitDeployJob2(config, request, options.signal), "the submit", undefined, options.signal));
855
+ if (submitError) {
856
+ if (options.signal?.aborted === true || !(submitError instanceof VssApiError)) {
857
+ return failure("lost-contact", `The submit of ${request.packageName} ${request.packageVersion} ${options.signal?.aborted === true ? "was interrupted before the service answered" : `did not get an answer the CLI could read (${submitError.message})`}, so it is not known whether a deploy job was created.`, checkBeforeResubmitting(options));
858
+ }
859
+ return toDeployFailure2(submitError, "Could not submit the deploy job", {
860
+ routing: options,
861
+ attempting: "submit"
862
+ });
863
+ }
864
+ writeProgress2(`Deploy job ${job.id} accepted and running.`);
865
+ if (options.wait === false) {
866
+ return { ok: true, outcome: "submitted", job };
867
+ }
868
+ return watchToCompletion(config, job, options, deps, {
869
+ serviceUrl: serviceUrl.value,
870
+ manifest,
871
+ sentResourceConfigurations: (request.resourceConfigurations ?? []).length > 0,
872
+ deploymentName: request.deploymentName
873
+ });
874
+ }
875
+ export {
876
+ runDeploy
877
+ };
878
+
879
+ //# debugId=81D3B772342BDCD064756E2164756E21