@uipath/function-tool 1.205.0-preview.281 → 1.206.0-preview.282

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.
@@ -0,0 +1,1130 @@
1
+ import {
2
+ catchError2,
3
+ getSdkUserAgentToken,
4
+ installSdkUserAgentHeader,
5
+ quoteForShell,
6
+ unsupportedSolutionProjectType
7
+ } from "./packager-tool-cmtxbmhx.js";
8
+ import {
9
+ __toESM,
10
+ __commonJS
11
+ } from "./packager-tool-epsr41wx.js";
12
+
13
+ // ../../node_modules/ignore/index.js
14
+ var require_ignore = __commonJS(function(exports, module) {
15
+ function makeArray(subject) {
16
+ return Array.isArray(subject) ? subject : [subject];
17
+ }
18
+ var EMPTY = "";
19
+ var SPACE = " ";
20
+ var ESCAPE = "\\";
21
+ var REGEX_TEST_BLANK_LINE = /^\s+$/;
22
+ var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
23
+ var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
24
+ var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
25
+ var REGEX_SPLITALL_CRLF = /\r?\n/g;
26
+ var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
27
+ var SLASH = "/";
28
+ var TMP_KEY_IGNORE = "node-ignore";
29
+ if (typeof Symbol !== "undefined") {
30
+ TMP_KEY_IGNORE = Symbol.for("node-ignore");
31
+ }
32
+ var KEY_IGNORE = TMP_KEY_IGNORE;
33
+ var define = (object, key, value) => Object.defineProperty(object, key, { value });
34
+ var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
35
+ var RETURN_FALSE = () => false;
36
+ var sanitizeRange = (range) => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY);
37
+ var cleanRangeBackSlash = (slashes) => {
38
+ const { length } = slashes;
39
+ return slashes.slice(0, length - length % 2);
40
+ };
41
+ var REPLACERS = [
42
+ [
43
+ /^\uFEFF/,
44
+ () => EMPTY
45
+ ],
46
+ [
47
+ /((?:\\\\)*?)(\\?\s+)$/,
48
+ (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
49
+ ],
50
+ [
51
+ /(\\+?)\s/g,
52
+ (_, m1) => {
53
+ const { length } = m1;
54
+ return m1.slice(0, length - length % 2) + SPACE;
55
+ }
56
+ ],
57
+ [
58
+ /[\\$.|*+(){^]/g,
59
+ (match) => `\\${match}`
60
+ ],
61
+ [
62
+ /(?!\\)\?/g,
63
+ () => "[^/]"
64
+ ],
65
+ [
66
+ /^\//,
67
+ () => "^"
68
+ ],
69
+ [
70
+ /\//g,
71
+ () => "\\/"
72
+ ],
73
+ [
74
+ /^\^*\\\*\\\*\\\//,
75
+ () => "^(?:.*\\/)?"
76
+ ],
77
+ [
78
+ /^(?=[^^])/,
79
+ function startingReplacer() {
80
+ return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
81
+ }
82
+ ],
83
+ [
84
+ /\\\/\\\*\\\*(?=\\\/|$)/g,
85
+ (_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
86
+ ],
87
+ [
88
+ /(^|[^\\]+)(\\\*)+(?=.+)/g,
89
+ (_, p1, p2) => {
90
+ const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
91
+ return p1 + unescaped;
92
+ }
93
+ ],
94
+ [
95
+ /\\\\\\(?=[$.|*+(){^])/g,
96
+ () => ESCAPE
97
+ ],
98
+ [
99
+ /\\\\/g,
100
+ () => ESCAPE
101
+ ],
102
+ [
103
+ /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
104
+ (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
105
+ ],
106
+ [
107
+ /(?:[^*])$/,
108
+ (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
109
+ ],
110
+ [
111
+ /(\^|\\\/)?\\\*$/,
112
+ (_, p1) => {
113
+ const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
114
+ return `${prefix}(?=$|\\/$)`;
115
+ }
116
+ ]
117
+ ];
118
+ var regexCache = Object.create(null);
119
+ var makeRegex = (pattern, ignoreCase) => {
120
+ let source = regexCache[pattern];
121
+ if (!source) {
122
+ source = REPLACERS.reduce((prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)), pattern);
123
+ regexCache[pattern] = source;
124
+ }
125
+ return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
126
+ };
127
+ var isString = (subject) => typeof subject === "string";
128
+ var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
129
+ var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
130
+
131
+ class IgnoreRule {
132
+ constructor(origin, pattern, negative, regex) {
133
+ this.origin = origin;
134
+ this.pattern = pattern;
135
+ this.negative = negative;
136
+ this.regex = regex;
137
+ }
138
+ }
139
+ var createRule = (pattern, ignoreCase) => {
140
+ const origin = pattern;
141
+ let negative = false;
142
+ if (pattern.indexOf("!") === 0) {
143
+ negative = true;
144
+ pattern = pattern.substr(1);
145
+ }
146
+ pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
147
+ const regex = makeRegex(pattern, ignoreCase);
148
+ return new IgnoreRule(origin, pattern, negative, regex);
149
+ };
150
+ var throwError = (message, Ctor) => {
151
+ throw new Ctor(message);
152
+ };
153
+ var checkPath = (path, originalPath, doThrow) => {
154
+ if (!isString(path)) {
155
+ return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
156
+ }
157
+ if (!path) {
158
+ return doThrow(`path must not be empty`, TypeError);
159
+ }
160
+ if (checkPath.isNotRelative(path)) {
161
+ const r = "`path.relative()`d";
162
+ return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
163
+ }
164
+ return true;
165
+ };
166
+ var isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
167
+ checkPath.isNotRelative = isNotRelative;
168
+ checkPath.convert = (p) => p;
169
+
170
+ class Ignore {
171
+ constructor({
172
+ ignorecase = true,
173
+ ignoreCase = ignorecase,
174
+ allowRelativePaths = false
175
+ } = {}) {
176
+ define(this, KEY_IGNORE, true);
177
+ this._rules = [];
178
+ this._ignoreCase = ignoreCase;
179
+ this._allowRelativePaths = allowRelativePaths;
180
+ this._initCache();
181
+ }
182
+ _initCache() {
183
+ this._ignoreCache = Object.create(null);
184
+ this._testCache = Object.create(null);
185
+ }
186
+ _addPattern(pattern) {
187
+ if (pattern && pattern[KEY_IGNORE]) {
188
+ this._rules = this._rules.concat(pattern._rules);
189
+ this._added = true;
190
+ return;
191
+ }
192
+ if (checkPattern(pattern)) {
193
+ const rule = createRule(pattern, this._ignoreCase);
194
+ this._added = true;
195
+ this._rules.push(rule);
196
+ }
197
+ }
198
+ add(pattern) {
199
+ this._added = false;
200
+ makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this);
201
+ if (this._added) {
202
+ this._initCache();
203
+ }
204
+ return this;
205
+ }
206
+ addPattern(pattern) {
207
+ return this.add(pattern);
208
+ }
209
+ _testOne(path, checkUnignored) {
210
+ let ignored = false;
211
+ let unignored = false;
212
+ this._rules.forEach((rule) => {
213
+ const { negative } = rule;
214
+ if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
215
+ return;
216
+ }
217
+ const matched = rule.regex.test(path);
218
+ if (matched) {
219
+ ignored = !negative;
220
+ unignored = negative;
221
+ }
222
+ });
223
+ return {
224
+ ignored,
225
+ unignored
226
+ };
227
+ }
228
+ _test(originalPath, cache, checkUnignored, slices) {
229
+ const path = originalPath && checkPath.convert(originalPath);
230
+ checkPath(path, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
231
+ return this._t(path, cache, checkUnignored, slices);
232
+ }
233
+ _t(path, cache, checkUnignored, slices) {
234
+ if (path in cache) {
235
+ return cache[path];
236
+ }
237
+ if (!slices) {
238
+ slices = path.split(SLASH);
239
+ }
240
+ slices.pop();
241
+ if (!slices.length) {
242
+ return cache[path] = this._testOne(path, checkUnignored);
243
+ }
244
+ const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
245
+ return cache[path] = parent.ignored ? parent : this._testOne(path, checkUnignored);
246
+ }
247
+ ignores(path) {
248
+ return this._test(path, this._ignoreCache, false).ignored;
249
+ }
250
+ createFilter() {
251
+ return (path) => !this.ignores(path);
252
+ }
253
+ filter(paths) {
254
+ return makeArray(paths).filter(this.createFilter());
255
+ }
256
+ test(path) {
257
+ return this._test(path, this._testCache, true);
258
+ }
259
+ }
260
+ var factory = (options) => new Ignore(options);
261
+ var isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
262
+ factory.isPathValid = isPathValid;
263
+ factory.default = factory;
264
+ module.exports = factory;
265
+ if (typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")) {
266
+ const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
267
+ checkPath.convert = makePosix;
268
+ const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
269
+ checkPath.isNotRelative = (path) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
270
+ }
271
+ });
272
+
273
+ // ../solution-sdk/generated/src/runtime.ts
274
+ var BASE_PATH = "https://alpha.uipath.com/uipattycyrhx/abizon_1/automationsolutions_".replace(/\/+$/, "");
275
+
276
+ class Configuration {
277
+ configuration;
278
+ constructor(configuration = {}) {
279
+ this.configuration = configuration;
280
+ }
281
+ set config(configuration) {
282
+ this.configuration = configuration;
283
+ }
284
+ get basePath() {
285
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
286
+ }
287
+ get fetchApi() {
288
+ return this.configuration.fetchApi;
289
+ }
290
+ get middleware() {
291
+ return this.configuration.middleware || [];
292
+ }
293
+ get queryParamsStringify() {
294
+ return this.configuration.queryParamsStringify || querystring;
295
+ }
296
+ get username() {
297
+ return this.configuration.username;
298
+ }
299
+ get password() {
300
+ return this.configuration.password;
301
+ }
302
+ get apiKey() {
303
+ const apiKey = this.configuration.apiKey;
304
+ if (apiKey) {
305
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
306
+ }
307
+ return;
308
+ }
309
+ get accessToken() {
310
+ const accessToken = this.configuration.accessToken;
311
+ if (accessToken) {
312
+ return typeof accessToken === "function" ? accessToken : async () => accessToken;
313
+ }
314
+ return;
315
+ }
316
+ get headers() {
317
+ return this.configuration.headers;
318
+ }
319
+ get credentials() {
320
+ return this.configuration.credentials;
321
+ }
322
+ }
323
+ var DefaultConfig = new Configuration;
324
+
325
+ class BaseAPI {
326
+ configuration;
327
+ static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
328
+ middleware;
329
+ constructor(configuration = DefaultConfig) {
330
+ this.configuration = configuration;
331
+ this.middleware = configuration.middleware;
332
+ }
333
+ withMiddleware(...middlewares) {
334
+ const next = this.clone();
335
+ next.middleware = next.middleware.concat(...middlewares);
336
+ return next;
337
+ }
338
+ withPreMiddleware(...preMiddlewares) {
339
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
340
+ return this.withMiddleware(...middlewares);
341
+ }
342
+ withPostMiddleware(...postMiddlewares) {
343
+ const middlewares = postMiddlewares.map((post) => ({ post }));
344
+ return this.withMiddleware(...middlewares);
345
+ }
346
+ isJsonMime(mime) {
347
+ if (!mime) {
348
+ return false;
349
+ }
350
+ return BaseAPI.jsonRegex.test(mime);
351
+ }
352
+ async request(context, initOverrides) {
353
+ const { url, init } = await this.createFetchParams(context, initOverrides);
354
+ const response = await this.fetchApi(url, init);
355
+ if (response && (response.status >= 200 && response.status < 300)) {
356
+ return response;
357
+ }
358
+ throw new ResponseError(response, "Response returned an error code");
359
+ }
360
+ async createFetchParams(context, initOverrides) {
361
+ let url = this.configuration.basePath + context.path;
362
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
363
+ url += "?" + this.configuration.queryParamsStringify(context.query);
364
+ }
365
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
366
+ Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
367
+ const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
368
+ const initParams = {
369
+ method: context.method,
370
+ headers,
371
+ body: context.body,
372
+ credentials: this.configuration.credentials
373
+ };
374
+ const overriddenInit = {
375
+ ...initParams,
376
+ ...await initOverrideFn({
377
+ init: initParams,
378
+ context
379
+ })
380
+ };
381
+ let body;
382
+ if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) {
383
+ body = overriddenInit.body;
384
+ } else if (this.isJsonMime(headers["Content-Type"])) {
385
+ body = JSON.stringify(overriddenInit.body);
386
+ } else {
387
+ body = overriddenInit.body;
388
+ }
389
+ const init = {
390
+ ...overriddenInit,
391
+ body
392
+ };
393
+ return { url, init };
394
+ }
395
+ fetchApi = async (url, init) => {
396
+ let fetchParams = { url, init };
397
+ for (const middleware of this.middleware) {
398
+ if (middleware.pre) {
399
+ fetchParams = await middleware.pre({
400
+ fetch: this.fetchApi,
401
+ ...fetchParams
402
+ }) || fetchParams;
403
+ }
404
+ }
405
+ let response = undefined;
406
+ try {
407
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
408
+ } catch (e) {
409
+ for (const middleware of this.middleware) {
410
+ if (middleware.onError) {
411
+ response = await middleware.onError({
412
+ fetch: this.fetchApi,
413
+ url: fetchParams.url,
414
+ init: fetchParams.init,
415
+ error: e,
416
+ response: response ? response.clone() : undefined
417
+ }) || response;
418
+ }
419
+ }
420
+ if (response === undefined) {
421
+ if (e instanceof Error) {
422
+ throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
423
+ } else {
424
+ throw e;
425
+ }
426
+ }
427
+ }
428
+ for (const middleware of this.middleware) {
429
+ if (middleware.post) {
430
+ response = await middleware.post({
431
+ fetch: this.fetchApi,
432
+ url: fetchParams.url,
433
+ init: fetchParams.init,
434
+ response: response.clone()
435
+ }) || response;
436
+ }
437
+ }
438
+ return response;
439
+ };
440
+ clone() {
441
+ const constructor = this.constructor;
442
+ const next = new constructor(this.configuration);
443
+ next.middleware = this.middleware.slice();
444
+ return next;
445
+ }
446
+ }
447
+ function isBlob(value) {
448
+ return typeof Blob !== "undefined" && value instanceof Blob;
449
+ }
450
+ function isFormData(value) {
451
+ return typeof FormData !== "undefined" && value instanceof FormData;
452
+ }
453
+
454
+ class ResponseError extends Error {
455
+ response;
456
+ name = "ResponseError";
457
+ constructor(response, msg) {
458
+ super(msg);
459
+ this.response = response;
460
+ }
461
+ }
462
+
463
+ class FetchError extends Error {
464
+ cause;
465
+ name = "FetchError";
466
+ constructor(cause, msg) {
467
+ super(msg);
468
+ this.cause = cause;
469
+ }
470
+ }
471
+ function querystring(params, prefix = "") {
472
+ return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
473
+ }
474
+ function querystringSingleKey(key, value, keyPrefix = "") {
475
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
476
+ if (value instanceof Array) {
477
+ const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
478
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
479
+ }
480
+ if (value instanceof Set) {
481
+ const valueAsArray = Array.from(value);
482
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
483
+ }
484
+ if (value instanceof Date) {
485
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
486
+ }
487
+ if (value instanceof Object) {
488
+ return querystring(value, fullKey);
489
+ }
490
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
491
+ }
492
+ // ../solution-sdk/package.json
493
+ var package_default = {
494
+ name: "@uipath/solution-sdk",
495
+ author: "UiPath",
496
+ license: "SEE LICENSE IN LICENSE.txt",
497
+ version: "1.206.0-preview.282",
498
+ repository: {
499
+ type: "git",
500
+ url: "https://github.com/UiPath/cli.git",
501
+ directory: "packages/solution-sdk"
502
+ },
503
+ publishConfig: {
504
+ registry: "https://npm.pkg.github.com/@uipath"
505
+ },
506
+ keywords: [
507
+ "uipath",
508
+ "solution",
509
+ "sdk"
510
+ ],
511
+ type: "module",
512
+ main: "./dist/index.js",
513
+ types: "./dist/src/index.d.ts",
514
+ exports: {
515
+ ".": {
516
+ types: "./dist/src/index.d.ts",
517
+ default: "./dist/index.js"
518
+ },
519
+ "./resources": {
520
+ types: "./dist/src/resources/index.d.ts",
521
+ default: "./dist/resources/index.js"
522
+ },
523
+ "./auth": {
524
+ types: "./dist/src/solution-auth.d.ts",
525
+ default: "./dist/solution-auth.js"
526
+ },
527
+ "./deployments": {
528
+ types: "./dist/src/deployment-search.d.ts",
529
+ default: "./dist/deployment-search.js"
530
+ },
531
+ "./packages": {
532
+ types: "./dist/src/package-search.d.ts",
533
+ default: "./dist/package-search.js"
534
+ },
535
+ "./project-context": {
536
+ types: "./dist/src/project-context.d.ts",
537
+ default: "./dist/project-context.js"
538
+ }
539
+ },
540
+ bin: {
541
+ "generate-sdk": "./dist/scripts/generate-sdk.js"
542
+ },
543
+ files: [
544
+ "dist"
545
+ ],
546
+ private: false,
547
+ scripts: {
548
+ build: "bun build ./src/index.ts ./src/resources/index.ts ./src/solution-auth.ts ./src/deployment-search.ts ./src/package-search.ts ./src/project-context.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",
549
+ generate: "bun run src/scripts/generate-sdk.ts",
550
+ lint: "biome check .",
551
+ test: "vitest run",
552
+ "test:coverage": "vitest run --coverage",
553
+ typecheck: "tsc --noEmit"
554
+ },
555
+ devDependencies: {
556
+ "@openapitools/openapi-generator-cli": "^2.31.1",
557
+ "@uipath/auth": "workspace:*",
558
+ "@uipath/common": "workspace:*",
559
+ "@uipath/filesystem": "workspace:*",
560
+ "@uipath/orchestrator-sdk": "workspace:*",
561
+ "@uipath/pipelines-sdk": "workspace:*",
562
+ "@uipath/resource-builder-sdk": "2025.11.0-alpha6584-4367",
563
+ "@uipath/solutionpackager-tool-core": "workspace:*",
564
+ "@uipath/studioweb-sdk": "workspace:*",
565
+ "@types/node": "^25.5.2",
566
+ fflate: "^0.8.2",
567
+ ignore: "^5.3.2",
568
+ typescript: "^7.0.2"
569
+ }
570
+ };
571
+
572
+ // ../solution-sdk/src/user-agent.ts
573
+ var SDK_USER_AGENT = getSdkUserAgentToken(package_default);
574
+ installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
575
+
576
+ // ../studioweb-sdk/generated/src/runtime.ts
577
+ var BASE_PATH2 = "https://alpha.uipath.com/studio_/backend".replace(/\/+$/, "");
578
+
579
+ class Configuration2 {
580
+ configuration;
581
+ constructor(configuration = {}) {
582
+ this.configuration = configuration;
583
+ }
584
+ set config(configuration) {
585
+ this.configuration = configuration;
586
+ }
587
+ get basePath() {
588
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH2;
589
+ }
590
+ get fetchApi() {
591
+ return this.configuration.fetchApi;
592
+ }
593
+ get middleware() {
594
+ return this.configuration.middleware || [];
595
+ }
596
+ get queryParamsStringify() {
597
+ return this.configuration.queryParamsStringify || querystring2;
598
+ }
599
+ get username() {
600
+ return this.configuration.username;
601
+ }
602
+ get password() {
603
+ return this.configuration.password;
604
+ }
605
+ get apiKey() {
606
+ const apiKey = this.configuration.apiKey;
607
+ if (apiKey) {
608
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
609
+ }
610
+ return;
611
+ }
612
+ get accessToken() {
613
+ const accessToken = this.configuration.accessToken;
614
+ if (accessToken) {
615
+ return typeof accessToken === "function" ? accessToken : async () => accessToken;
616
+ }
617
+ return;
618
+ }
619
+ get headers() {
620
+ return this.configuration.headers;
621
+ }
622
+ get credentials() {
623
+ return this.configuration.credentials;
624
+ }
625
+ }
626
+ var DefaultConfig2 = new Configuration2;
627
+
628
+ class BaseAPI2 {
629
+ configuration;
630
+ static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
631
+ middleware;
632
+ constructor(configuration = DefaultConfig2) {
633
+ this.configuration = configuration;
634
+ this.middleware = configuration.middleware;
635
+ }
636
+ withMiddleware(...middlewares) {
637
+ const next = this.clone();
638
+ next.middleware = next.middleware.concat(...middlewares);
639
+ return next;
640
+ }
641
+ withPreMiddleware(...preMiddlewares) {
642
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
643
+ return this.withMiddleware(...middlewares);
644
+ }
645
+ withPostMiddleware(...postMiddlewares) {
646
+ const middlewares = postMiddlewares.map((post) => ({ post }));
647
+ return this.withMiddleware(...middlewares);
648
+ }
649
+ isJsonMime(mime) {
650
+ if (!mime) {
651
+ return false;
652
+ }
653
+ return BaseAPI2.jsonRegex.test(mime);
654
+ }
655
+ async request(context, initOverrides) {
656
+ const { url, init } = await this.createFetchParams(context, initOverrides);
657
+ const response = await this.fetchApi(url, init);
658
+ if (response && (response.status >= 200 && response.status < 300)) {
659
+ return response;
660
+ }
661
+ throw new ResponseError2(response, "Response returned an error code");
662
+ }
663
+ async createFetchParams(context, initOverrides) {
664
+ let url = this.configuration.basePath + context.path;
665
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
666
+ url += "?" + this.configuration.queryParamsStringify(context.query);
667
+ }
668
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
669
+ Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
670
+ const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
671
+ const initParams = {
672
+ method: context.method,
673
+ headers,
674
+ body: context.body,
675
+ credentials: this.configuration.credentials
676
+ };
677
+ const overriddenInit = {
678
+ ...initParams,
679
+ ...await initOverrideFn({
680
+ init: initParams,
681
+ context
682
+ })
683
+ };
684
+ let body;
685
+ if (isFormData2(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob2(overriddenInit.body)) {
686
+ body = overriddenInit.body;
687
+ } else if (this.isJsonMime(headers["Content-Type"])) {
688
+ body = JSON.stringify(overriddenInit.body);
689
+ } else {
690
+ body = overriddenInit.body;
691
+ }
692
+ const init = {
693
+ ...overriddenInit,
694
+ body
695
+ };
696
+ return { url, init };
697
+ }
698
+ fetchApi = async (url, init) => {
699
+ let fetchParams = { url, init };
700
+ for (const middleware of this.middleware) {
701
+ if (middleware.pre) {
702
+ fetchParams = await middleware.pre({
703
+ fetch: this.fetchApi,
704
+ ...fetchParams
705
+ }) || fetchParams;
706
+ }
707
+ }
708
+ let response = undefined;
709
+ try {
710
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
711
+ } catch (e) {
712
+ for (const middleware of this.middleware) {
713
+ if (middleware.onError) {
714
+ response = await middleware.onError({
715
+ fetch: this.fetchApi,
716
+ url: fetchParams.url,
717
+ init: fetchParams.init,
718
+ error: e,
719
+ response: response ? response.clone() : undefined
720
+ }) || response;
721
+ }
722
+ }
723
+ if (response === undefined) {
724
+ if (e instanceof Error) {
725
+ throw new FetchError2(e, "The request failed and the interceptors did not return an alternative response");
726
+ } else {
727
+ throw e;
728
+ }
729
+ }
730
+ }
731
+ for (const middleware of this.middleware) {
732
+ if (middleware.post) {
733
+ response = await middleware.post({
734
+ fetch: this.fetchApi,
735
+ url: fetchParams.url,
736
+ init: fetchParams.init,
737
+ response: response.clone()
738
+ }) || response;
739
+ }
740
+ }
741
+ return response;
742
+ };
743
+ clone() {
744
+ const constructor = this.constructor;
745
+ const next = new constructor(this.configuration);
746
+ next.middleware = this.middleware.slice();
747
+ return next;
748
+ }
749
+ }
750
+ function isBlob2(value) {
751
+ return typeof Blob !== "undefined" && value instanceof Blob;
752
+ }
753
+ function isFormData2(value) {
754
+ return typeof FormData !== "undefined" && value instanceof FormData;
755
+ }
756
+
757
+ class ResponseError2 extends Error {
758
+ response;
759
+ name = "ResponseError";
760
+ constructor(response, msg) {
761
+ super(msg);
762
+ this.response = response;
763
+ }
764
+ }
765
+
766
+ class FetchError2 extends Error {
767
+ cause;
768
+ name = "FetchError";
769
+ constructor(cause, msg) {
770
+ super(msg);
771
+ this.cause = cause;
772
+ }
773
+ }
774
+ function querystring2(params, prefix = "") {
775
+ return Object.keys(params).map((key) => querystringSingleKey2(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
776
+ }
777
+ function querystringSingleKey2(key, value, keyPrefix = "") {
778
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
779
+ if (value instanceof Array) {
780
+ const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
781
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
782
+ }
783
+ if (value instanceof Set) {
784
+ const valueAsArray = Array.from(value);
785
+ return querystringSingleKey2(key, valueAsArray, keyPrefix);
786
+ }
787
+ if (value instanceof Date) {
788
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
789
+ }
790
+ if (value instanceof Object) {
791
+ return querystring2(value, fullKey);
792
+ }
793
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
794
+ }
795
+ // ../solution-sdk/src/solution-file.ts
796
+ var STUDIO_WEB_PROJECT_TYPE_OVERRIDES = {
797
+ ProcessOrchestration: "processOrchestration"
798
+ };
799
+ function normalizeProjectType(projectType) {
800
+ return STUDIO_WEB_PROJECT_TYPE_OVERRIDES[projectType] ?? projectType;
801
+ }
802
+ function toPortableRelativePath(relativePath) {
803
+ return relativePath.replace(/\\/g, "/");
804
+ }
805
+ function isRecord(value) {
806
+ return typeof value === "object" && value !== null && !Array.isArray(value);
807
+ }
808
+ async function tryRegisterProjectInParentSolution(fs, projectDir, options) {
809
+ if (options?.skipRegistration) {
810
+ return {
811
+ Status: "OptedOut",
812
+ Message: "Solution auto-registration skipped (--skip-solution-registration).",
813
+ Instructions: buildOptedOutInstructions(fs.path.resolve(projectDir))
814
+ };
815
+ }
816
+ const [registrationError, registration] = await catchError2(registerProjectInParentSolution(fs, projectDir));
817
+ if (registrationError) {
818
+ return {
819
+ Status: "Failed",
820
+ Message: "Project registration failed.",
821
+ Instructions: buildRegistrationFailureInstructions(projectDir, registrationError.message)
822
+ };
823
+ }
824
+ return registration;
825
+ }
826
+ async function registerProjectInParentSolution(fs, projectDir) {
827
+ const resolvedProjectDir = fs.path.resolve(projectDir);
828
+ const discovery = await findNearestParentUipxFile(fs, resolvedProjectDir);
829
+ if (discovery.status === "notFound") {
830
+ return {
831
+ Status: "NotInSolution",
832
+ Message: "Project created in standalone mode; no parent .uipx solution found.",
833
+ Instructions: buildStandaloneInstructions(resolvedProjectDir)
834
+ };
835
+ }
836
+ if (discovery.status === "skipped") {
837
+ return discovery.registration;
838
+ }
839
+ const solutionFile = discovery.solutionFile;
840
+ const solutionDir = fs.path.dirname(solutionFile);
841
+ const relativeProjectDir = fs.path.relative(solutionDir, resolvedProjectDir);
842
+ if (relativeProjectDir === "" || relativeProjectDir.startsWith("..") || fs.path.isAbsolute(relativeProjectDir)) {
843
+ return {
844
+ Status: "Skipped",
845
+ Message: "Project registration skipped.",
846
+ Solution: solutionFile,
847
+ Instructions: `Project must reside within the solution folder.
848
+ Solution: ${solutionDir}
849
+ Project: ${resolvedProjectDir}`
850
+ };
851
+ }
852
+ const [projectFileError, projectFile] = await findProjectFile(fs, resolvedProjectDir);
853
+ if (projectFileError) {
854
+ return {
855
+ Status: "Failed",
856
+ Message: "Project registration failed.",
857
+ Solution: solutionFile,
858
+ Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, projectFileError.message)
859
+ };
860
+ }
861
+ const [projectManifestError, projectManifest] = await readProjectManifest(fs, projectFile.filePath, projectFile.useProjectJson);
862
+ if (projectManifestError) {
863
+ return {
864
+ Status: "Failed",
865
+ Message: "Project registration failed.",
866
+ Solution: solutionFile,
867
+ Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, projectManifestError.message)
868
+ };
869
+ }
870
+ const unsupportedReason = unsupportedSolutionProjectType(projectManifest.projectType);
871
+ if (unsupportedReason) {
872
+ return {
873
+ Status: "Skipped",
874
+ Message: "Project registration skipped.",
875
+ Solution: solutionFile,
876
+ Instructions: unsupportedReason
877
+ };
878
+ }
879
+ const projectRelativePath = toPortableRelativePath(fs.path.join(relativeProjectDir, projectFile.fileName));
880
+ const [solutionError, solution] = await readSolutionManifest(fs, solutionFile);
881
+ if (solutionError) {
882
+ return {
883
+ Status: "Failed",
884
+ Message: "Project registration failed.",
885
+ Solution: solutionFile,
886
+ Project: projectRelativePath,
887
+ Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, solutionError.message)
888
+ };
889
+ }
890
+ const existingProject = solution.projects.find((project) => toPortableRelativePath(project.ProjectRelativePath) === projectRelativePath);
891
+ if (existingProject) {
892
+ return {
893
+ Status: "AlreadyRegistered",
894
+ Message: "Project already registered in solution.",
895
+ Solution: solutionFile,
896
+ Project: projectRelativePath,
897
+ ProjectId: typeof existingProject.Id === "string" ? existingProject.Id : undefined,
898
+ Instructions: buildRegistrationSuccessInstructions(solutionDir)
899
+ };
900
+ }
901
+ const projectId = crypto.randomUUID();
902
+ solution.projects.push({
903
+ Type: normalizeProjectType(projectManifest.projectType),
904
+ ProjectRelativePath: projectRelativePath,
905
+ Id: projectId
906
+ });
907
+ solution.content.Projects = solution.projects;
908
+ const [writeError] = await catchError2(fs.writeFile(solutionFile, `${JSON.stringify(solution.content, null, 2)}
909
+ `));
910
+ if (writeError) {
911
+ return {
912
+ Status: "Failed",
913
+ Message: "Project registration failed.",
914
+ Solution: solutionFile,
915
+ Project: projectRelativePath,
916
+ Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, writeError.message)
917
+ };
918
+ }
919
+ return {
920
+ Status: "Registered",
921
+ Message: "Project registered in parent solution.",
922
+ Solution: solutionFile,
923
+ Project: projectRelativePath,
924
+ ProjectId: projectId,
925
+ Instructions: buildRegistrationSuccessInstructions(solutionDir)
926
+ };
927
+ }
928
+ async function findNearestParentUipxFile(fs, projectDir) {
929
+ let currentDir = fs.path.dirname(fs.path.resolve(projectDir));
930
+ while (true) {
931
+ const [readDirError, entries] = await catchError2(fs.readdir(currentDir));
932
+ if (readDirError) {
933
+ return {
934
+ status: "skipped",
935
+ registration: {
936
+ Status: "Failed",
937
+ Message: "Project registration failed.",
938
+ Instructions: buildRegistrationFailureInstructions(projectDir, `Could not inspect parent directory for a solution: ${currentDir}
939
+ ${readDirError.message}`)
940
+ }
941
+ };
942
+ }
943
+ const solutionFiles = entries.filter((entry) => entry.endsWith(".uipx"));
944
+ if (solutionFiles.length > 1) {
945
+ return {
946
+ status: "skipped",
947
+ registration: {
948
+ Status: "Skipped",
949
+ Message: "Project registration skipped.",
950
+ Instructions: `Found multiple .uipx files in ${currentDir}: ${solutionFiles.join(", ")}. Run 'uip solution projects add "${projectDir}" <solution.uipx>' to choose one.`
951
+ }
952
+ };
953
+ }
954
+ if (solutionFiles.length === 1) {
955
+ return {
956
+ status: "found",
957
+ solutionFile: fs.path.join(currentDir, solutionFiles[0])
958
+ };
959
+ }
960
+ const parentDir = fs.path.dirname(currentDir);
961
+ if (parentDir === currentDir) {
962
+ return { status: "notFound" };
963
+ }
964
+ currentDir = parentDir;
965
+ }
966
+ }
967
+ async function findProjectFile(fs, projectDir) {
968
+ const uiprojPath = fs.path.join(projectDir, "project.uiproj");
969
+ if (await fs.exists(uiprojPath)) {
970
+ return [
971
+ null,
972
+ {
973
+ filePath: uiprojPath,
974
+ fileName: "project.uiproj",
975
+ useProjectJson: false
976
+ }
977
+ ];
978
+ }
979
+ const jsonProjectPath = fs.path.join(projectDir, "project.json");
980
+ if (await fs.exists(jsonProjectPath)) {
981
+ return [
982
+ null,
983
+ {
984
+ filePath: jsonProjectPath,
985
+ fileName: "project.json",
986
+ useProjectJson: true
987
+ }
988
+ ];
989
+ }
990
+ return [
991
+ new Error(`No project file found in ${projectDir}. Expected project.uiproj or project.json.`),
992
+ null
993
+ ];
994
+ }
995
+ async function readProjectManifest(fs, filePath, useProjectJson) {
996
+ const [readError, rawContent] = await catchError2(fs.readFile(filePath, "utf-8"));
997
+ if (readError || !rawContent) {
998
+ return [readError ?? new Error(`Unable to read ${filePath}.`), null];
999
+ }
1000
+ const [parseError, parsed] = catchError2(() => JSON.parse(rawContent));
1001
+ if (parseError) {
1002
+ return [
1003
+ new Error(`Invalid JSON in project file: ${parseError.message}`),
1004
+ null
1005
+ ];
1006
+ }
1007
+ if (!isRecord(parsed)) {
1008
+ return [new Error(`Invalid project file: ${filePath}`), null];
1009
+ }
1010
+ const designOptions = parsed.designOptions;
1011
+ const outputType = useProjectJson && isRecord(designOptions) ? readString(designOptions.outputType) : undefined;
1012
+ const projectType = outputType ?? readString(parsed.ProjectType);
1013
+ if (!projectType) {
1014
+ return [new Error(`ProjectType not found in ${filePath}`), null];
1015
+ }
1016
+ return [
1017
+ null,
1018
+ {
1019
+ projectType
1020
+ }
1021
+ ];
1022
+ }
1023
+ async function readSolutionManifest(fs, solutionFile) {
1024
+ const [readError, rawContent] = await catchError2(fs.readFile(solutionFile, "utf-8"));
1025
+ if (readError || !rawContent) {
1026
+ return [
1027
+ readError ?? new Error(`Unable to read solution file: ${solutionFile}`),
1028
+ null
1029
+ ];
1030
+ }
1031
+ const [parseError, parsed] = catchError2(() => JSON.parse(rawContent));
1032
+ if (parseError) {
1033
+ return [
1034
+ new Error(`Invalid JSON in solution file: ${parseError.message}`),
1035
+ null
1036
+ ];
1037
+ }
1038
+ if (!isRecord(parsed)) {
1039
+ return [
1040
+ new Error(`Invalid solution file: ${solutionFile} must contain a JSON object.`),
1041
+ null
1042
+ ];
1043
+ }
1044
+ if (!Array.isArray(parsed.Projects)) {
1045
+ return [
1046
+ new Error(`Invalid solution file: ${solutionFile} must contain a Projects array.`),
1047
+ null
1048
+ ];
1049
+ }
1050
+ const projects = [];
1051
+ for (const [index, project] of parsed.Projects.entries()) {
1052
+ if (!isRecord(project)) {
1053
+ return [
1054
+ new Error(`Invalid solution file: Projects[${index}] must be an object.`),
1055
+ null
1056
+ ];
1057
+ }
1058
+ const projectRelativePath = readString(project.ProjectRelativePath);
1059
+ if (!projectRelativePath) {
1060
+ return [
1061
+ new Error(`Invalid solution file: Projects[${index}] is missing ProjectRelativePath. Use 'uip solution projects add' to repair the manifest.`),
1062
+ null
1063
+ ];
1064
+ }
1065
+ projects.push({
1066
+ ...project,
1067
+ Type: readString(project.Type) ?? "",
1068
+ ProjectRelativePath: projectRelativePath,
1069
+ Id: readString(project.Id) ?? ""
1070
+ });
1071
+ }
1072
+ return [null, { content: parsed, projects }];
1073
+ }
1074
+ function readString(value) {
1075
+ return typeof value === "string" && value.length > 0 ? value : undefined;
1076
+ }
1077
+ function buildRegistrationSuccessInstructions(solutionDir) {
1078
+ return [
1079
+ "The project is listed in the parent solution manifest.",
1080
+ "Packing or uploading the solution will sync solution resources automatically.",
1081
+ `To sync resources before packaging, run: uip solution resources refresh --solution-folder ${quoteForShell(solutionDir)}`
1082
+ ].join(`
1083
+ `);
1084
+ }
1085
+ function buildRegistrationFailureInstructions(projectDir, details) {
1086
+ return [
1087
+ "Automatic solution registration could not complete.",
1088
+ `Run 'uip solution projects add "${projectDir}" <solution.uipx>' after checking the project and solution files.`,
1089
+ `Details: ${details}`
1090
+ ].join(`
1091
+ `);
1092
+ }
1093
+ function buildStandaloneInstructions(projectDir) {
1094
+ return [
1095
+ "No parent solution was found by walking ancestor directories.",
1096
+ "Studio Web upload, `flow debug`, and packaging require an enclosing solution.",
1097
+ `To link this project to a solution, run 'uip solution init "<SolutionName>"' then 'uip solution projects add "${projectDir}" <SolutionName>.uipx'.`
1098
+ ].join(`
1099
+ `);
1100
+ }
1101
+ function buildOptedOutInstructions(projectDir) {
1102
+ return [
1103
+ "Automatic solution registration was skipped because --skip-solution-registration was passed.",
1104
+ `To register this project later, run 'uip solution projects add "${projectDir}" <SolutionName>.uipx' from within the solution.`
1105
+ ].join(`
1106
+ `);
1107
+ }
1108
+
1109
+ // ../solution-sdk/src/studio-web-compat.ts
1110
+ var API_PROJECT_TYPES = new Set(["api", "apiautomation"]);
1111
+
1112
+ // ../solution-sdk/src/zip-utils.ts
1113
+ var import_ignore = __toESM(require_ignore(), 1);
1114
+ var DEFAULT_EXCLUDED_DIR_NAMES = new Set([
1115
+ ".venv",
1116
+ "node_modules",
1117
+ "__pycache__",
1118
+ ".git",
1119
+ ".local",
1120
+ ".flow-sdk",
1121
+ ".flow-debug"
1122
+ ]);
1123
+ // ../solution-sdk/src/project-debug-status.ts
1124
+ var SUCCEEDED = "creationsucceeded";
1125
+ var TERMINAL = new Set([SUCCEEDED, "creationfailed", "validationfailed"]);
1126
+ export {
1127
+ tryRegisterProjectInParentSolution
1128
+ };
1129
+
1130
+ //# debugId=90F2B2B756253CB864756E2164756E21