@uipath/rules-tool 0.0.0-stage → 1.204.0-preview.249

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 (139) hide show
  1. package/LICENSE.txt +3 -0
  2. package/README.md +80 -2
  3. package/dist/DmnFactory-SG3RP3T3-cr8e7mxz.js +8 -0
  4. package/dist/DmnFactory-VWZOSZHH-azx0zqcn.js +8 -0
  5. package/dist/DmnModelTypes-ATR7FVKZ-vkv7n0jn.js +8 -0
  6. package/dist/KieDmnMarshaller-6TTUU5B4-rsxhvw7a.js +8 -0
  7. package/dist/business-rules-d51977r1.js +25 -0
  8. package/dist/business-rules-dekge24t.js +23 -0
  9. package/dist/business-rules-ew76mbwg.js +25 -0
  10. package/dist/business-rules-jmwx05k2.js +25 -0
  11. package/dist/business-rules-zpzqxyce.js +26 -0
  12. package/dist/constants-4r8pfr16.js +22 -0
  13. package/dist/constants-za5vbzp8.js +22 -0
  14. package/dist/embedded-file-reader-0228j82a.js +111 -0
  15. package/dist/embedded-file-reader-wmsg31a8.js +111 -0
  16. package/dist/first-party-service-1qa6cp4d.js +8 -0
  17. package/dist/first-party-service-28dkctkz.js +8 -0
  18. package/dist/first-party-service-4fsz3cnj.js +8 -0
  19. package/dist/first-party-service-ahcc6xc6.js +8 -0
  20. package/dist/first-party-service-y1ccmsvp.js +8 -0
  21. package/dist/first-party-service-zpr1q3nd.js +8 -0
  22. package/dist/hitPolicyResult-4WDHTX4A-dbtkgpqp.js +12 -0
  23. package/dist/index-2zxy6zgp.js +23 -0
  24. package/dist/index-3nx77wfh.js +23 -0
  25. package/dist/index-43zg1wqe.js +19621 -0
  26. package/dist/index-47jera73.js +23 -0
  27. package/dist/index-70jn7cz1.js +19631 -0
  28. package/dist/index-7wc0g78k.js +14 -0
  29. package/dist/index-8kb5kc5y.js +24 -0
  30. package/dist/index-97yad7ms.js +8 -0
  31. package/dist/index-dfn83hxf.js +14 -0
  32. package/dist/index-e301h23h.js +24 -0
  33. package/dist/index-frd259yv.js +24 -0
  34. package/dist/index-gc7cw2jh.js +23 -0
  35. package/dist/index-gya2v502.js +8 -0
  36. package/dist/index-hb3gk1wf.js +24 -0
  37. package/dist/index-nsnfdqd5.js +24 -0
  38. package/dist/index-nzr4mx5p.js +614 -0
  39. package/dist/index-vffktc0w.js +166 -0
  40. package/dist/index-we6zjs66.js +164 -0
  41. package/dist/index-xymrydfw.js +3095 -0
  42. package/dist/index-z2qk2qn6.js +24 -0
  43. package/dist/index-zdwhfpt1.js +3071 -0
  44. package/dist/index-zecwgvg7.js +23 -0
  45. package/dist/index.js +16 -0
  46. package/dist/jmespath-ab6tdc42.js +1485 -0
  47. package/dist/js-yaml-a2bk27p6.js +3151 -0
  48. package/dist/rule-catalog-a5w86qns.js +43 -0
  49. package/dist/rule-catalog-etpf962f.js +69 -0
  50. package/dist/rule-catalog-q5cr17hf.js +58 -0
  51. package/dist/rule-catalog-vc98yg4n.js +43 -0
  52. package/dist/rule-catalog-z3h66kh5.js +56 -0
  53. package/dist/rules-command-error-10qmb5w7.js +13 -0
  54. package/dist/rules-command-error-5bdv4bcx.js +13 -0
  55. package/dist/rules-command-error-cmssf0w4.js +13 -0
  56. package/dist/rules-command-error-fsm3b1mv.js +13 -0
  57. package/dist/rules-debug-service-5rcdh3pj.js +192 -0
  58. package/dist/rules-debug-service-8q7mkd0r.js +199 -0
  59. package/dist/rules-debug-service-b9j29ejz.js +192 -0
  60. package/dist/rules-debug-service-h1ahd6p3.js +192 -0
  61. package/dist/rules-debug-service-v3jr3r1n.js +192 -0
  62. package/dist/rules-init-service-3c2yfa7p.js +687 -0
  63. package/dist/rules-init-service-3wgd9cqp.js +100 -0
  64. package/dist/rules-init-service-8fqytxq0.js +685 -0
  65. package/dist/rules-init-service-pspt7sje.js +100 -0
  66. package/dist/rules-init-service-sbtzw93j.js +102 -0
  67. package/dist/rules-init-service-x7paqa63.js +687 -0
  68. package/dist/rules-init-service-y678kjje.js +100 -0
  69. package/dist/rules-init-service-y7qzmxx0.js +102 -0
  70. package/dist/rules-refresh-service-4xxj6ex6.js +65 -0
  71. package/dist/rules-refresh-service-ba5jk1y9.js +65 -0
  72. package/dist/rules-refresh-service-btn64j8j.js +65 -0
  73. package/dist/rules-refresh-service-qkmphj53.js +65 -0
  74. package/dist/rules-validate-service-dmgnfne7.js +60 -0
  75. package/dist/rules-validate-service-hk2d006t.js +60 -0
  76. package/dist/rules-validate-service-sppr4x13.js +60 -0
  77. package/dist/rules-validate-service-xp05n2d9.js +60 -0
  78. package/dist/tool-0bthsb3x.js +55 -0
  79. package/dist/tool-1dycs173.js +4014 -0
  80. package/dist/tool-1pkqxwwd.js +17472 -0
  81. package/dist/tool-24mr6g8c.js +1556 -0
  82. package/dist/tool-2trg1fpx.js +40 -0
  83. package/dist/tool-39fmkx2d.js +611 -0
  84. package/dist/tool-3e2q1x2y.js +6578 -0
  85. package/dist/tool-3j0747gg.js +17077 -0
  86. package/dist/tool-4z7zcq4z.js +6058 -0
  87. package/dist/tool-56smnjrh.js +73 -0
  88. package/dist/tool-5qygptrc.js +6171 -0
  89. package/dist/tool-5xx6x8pe.js +6596 -0
  90. package/dist/tool-6rp0gx98.js +6578 -0
  91. package/dist/tool-6sqt4zrx.js +571 -0
  92. package/dist/tool-7fkrd618.js +1556 -0
  93. package/dist/tool-7xmarr97.js +17077 -0
  94. package/dist/tool-89xzeteg.js +361 -0
  95. package/dist/tool-8j9f6ns5.js +6396 -0
  96. package/dist/tool-911s9czz.js +570 -0
  97. package/dist/tool-97x3zjcm.js +709 -0
  98. package/dist/tool-9bz2x04j.js +40 -0
  99. package/dist/tool-akh7nnqs.js +704 -0
  100. package/dist/tool-axfzew45.js +1555 -0
  101. package/dist/tool-b71jq9pt.js +389 -0
  102. package/dist/tool-bfj846v8.js +141 -0
  103. package/dist/tool-bvmc017m.js +96 -0
  104. package/dist/tool-bykz5ryf.js +454 -0
  105. package/dist/tool-c76qb8ap.js +17052 -0
  106. package/dist/tool-ca15515v.js +570 -0
  107. package/dist/tool-e1mmqsjr.js +11048 -0
  108. package/dist/tool-epsr41wx.js +48 -0
  109. package/dist/tool-f9qs255w.js +70 -0
  110. package/dist/tool-fbqnqf9k.js +10 -0
  111. package/dist/tool-ga79rety.js +389 -0
  112. package/dist/tool-gb547mcn.js +141 -0
  113. package/dist/tool-gta9rr4h.js +68 -0
  114. package/dist/tool-h2dfnxdq.js +6486 -0
  115. package/dist/tool-hg6vr5y9.js +3769 -0
  116. package/dist/tool-hgvnm4vh.js +1843 -0
  117. package/dist/tool-hjbf9aay.js +571 -0
  118. package/dist/tool-k2s349kn.js +108 -0
  119. package/dist/tool-k5jm64n3.js +5650 -0
  120. package/dist/tool-ketztpgf.js +73 -0
  121. package/dist/tool-mm1x18d6.js +537 -0
  122. package/dist/tool-n1d88ryb.js +6396 -0
  123. package/dist/tool-nmqpwh9m.js +6166 -0
  124. package/dist/tool-pb80pswx.js +73 -0
  125. package/dist/tool-pcsgwpfw.js +40 -0
  126. package/dist/tool-q3c1bjyb.js +454 -0
  127. package/dist/tool-rwp1skmf.js +40 -0
  128. package/dist/tool-s3fbt22r.js +454 -0
  129. package/dist/tool-tmbst1r8.js +68 -0
  130. package/dist/tool-v6w109p0.js +455 -0
  131. package/dist/tool-vyx8fpft.js +46 -0
  132. package/dist/tool-w2js05qv.js +389 -0
  133. package/dist/tool-x67kek1m.js +1838 -0
  134. package/dist/tool-x89947ah.js +17052 -0
  135. package/dist/tool-xhksjdka.js +4005 -0
  136. package/dist/tool-yv3t4gg5.js +108 -0
  137. package/dist/tool-zbyb1ttx.js +5650 -0
  138. package/dist/tool.js +11 -0
  139. package/package.json +43 -5
@@ -0,0 +1,687 @@
1
+ import {
2
+ getFileSystem,
3
+ catchError,
4
+ getSdkUserAgentToken,
5
+ installSdkUserAgentHeader
6
+ } from "./tool-k5jm64n3.js";
7
+ import {
8
+ prepareProjectLocation,
9
+ tryRegisterProjectInParentSolution
10
+ } from "./tool-w2js05qv.js";
11
+
12
+ // ../maestro-sdk/src/shared-utils.ts
13
+ var VALID_PROJECT_NAME_REGEX = /^[a-zA-Z0-9_-]+$/;
14
+
15
+ // ../solution-sdk/generated/src/runtime.ts
16
+ var BASE_PATH = "https://alpha.uipath.com/uipattycyrhx/abizon_1/automationsolutions_".replace(/\/+$/, "");
17
+
18
+ class Configuration {
19
+ configuration;
20
+ constructor(configuration = {}) {
21
+ this.configuration = configuration;
22
+ }
23
+ set config(configuration) {
24
+ this.configuration = configuration;
25
+ }
26
+ get basePath() {
27
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
28
+ }
29
+ get fetchApi() {
30
+ return this.configuration.fetchApi;
31
+ }
32
+ get middleware() {
33
+ return this.configuration.middleware || [];
34
+ }
35
+ get queryParamsStringify() {
36
+ return this.configuration.queryParamsStringify || querystring;
37
+ }
38
+ get username() {
39
+ return this.configuration.username;
40
+ }
41
+ get password() {
42
+ return this.configuration.password;
43
+ }
44
+ get apiKey() {
45
+ const apiKey = this.configuration.apiKey;
46
+ if (apiKey) {
47
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
48
+ }
49
+ return;
50
+ }
51
+ get accessToken() {
52
+ const accessToken = this.configuration.accessToken;
53
+ if (accessToken) {
54
+ return typeof accessToken === "function" ? accessToken : async () => accessToken;
55
+ }
56
+ return;
57
+ }
58
+ get headers() {
59
+ return this.configuration.headers;
60
+ }
61
+ get credentials() {
62
+ return this.configuration.credentials;
63
+ }
64
+ }
65
+ var DefaultConfig = new Configuration;
66
+
67
+ class BaseAPI {
68
+ configuration;
69
+ static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
70
+ middleware;
71
+ constructor(configuration = DefaultConfig) {
72
+ this.configuration = configuration;
73
+ this.middleware = configuration.middleware;
74
+ }
75
+ withMiddleware(...middlewares) {
76
+ const next = this.clone();
77
+ next.middleware = next.middleware.concat(...middlewares);
78
+ return next;
79
+ }
80
+ withPreMiddleware(...preMiddlewares) {
81
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
82
+ return this.withMiddleware(...middlewares);
83
+ }
84
+ withPostMiddleware(...postMiddlewares) {
85
+ const middlewares = postMiddlewares.map((post) => ({ post }));
86
+ return this.withMiddleware(...middlewares);
87
+ }
88
+ isJsonMime(mime) {
89
+ if (!mime) {
90
+ return false;
91
+ }
92
+ return BaseAPI.jsonRegex.test(mime);
93
+ }
94
+ async request(context, initOverrides) {
95
+ const { url, init } = await this.createFetchParams(context, initOverrides);
96
+ const response = await this.fetchApi(url, init);
97
+ if (response && (response.status >= 200 && response.status < 300)) {
98
+ return response;
99
+ }
100
+ throw new ResponseError(response, "Response returned an error code");
101
+ }
102
+ async createFetchParams(context, initOverrides) {
103
+ let url = this.configuration.basePath + context.path;
104
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
105
+ url += "?" + this.configuration.queryParamsStringify(context.query);
106
+ }
107
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
108
+ Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
109
+ const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
110
+ const initParams = {
111
+ method: context.method,
112
+ headers,
113
+ body: context.body,
114
+ credentials: this.configuration.credentials
115
+ };
116
+ const overriddenInit = {
117
+ ...initParams,
118
+ ...await initOverrideFn({
119
+ init: initParams,
120
+ context
121
+ })
122
+ };
123
+ let body;
124
+ if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) {
125
+ body = overriddenInit.body;
126
+ } else if (this.isJsonMime(headers["Content-Type"])) {
127
+ body = JSON.stringify(overriddenInit.body);
128
+ } else {
129
+ body = overriddenInit.body;
130
+ }
131
+ const init = {
132
+ ...overriddenInit,
133
+ body
134
+ };
135
+ return { url, init };
136
+ }
137
+ fetchApi = async (url, init) => {
138
+ let fetchParams = { url, init };
139
+ for (const middleware of this.middleware) {
140
+ if (middleware.pre) {
141
+ fetchParams = await middleware.pre({
142
+ fetch: this.fetchApi,
143
+ ...fetchParams
144
+ }) || fetchParams;
145
+ }
146
+ }
147
+ let response = undefined;
148
+ try {
149
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
150
+ } catch (e) {
151
+ for (const middleware of this.middleware) {
152
+ if (middleware.onError) {
153
+ response = await middleware.onError({
154
+ fetch: this.fetchApi,
155
+ url: fetchParams.url,
156
+ init: fetchParams.init,
157
+ error: e,
158
+ response: response ? response.clone() : undefined
159
+ }) || response;
160
+ }
161
+ }
162
+ if (response === undefined) {
163
+ if (e instanceof Error) {
164
+ throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
165
+ } else {
166
+ throw e;
167
+ }
168
+ }
169
+ }
170
+ for (const middleware of this.middleware) {
171
+ if (middleware.post) {
172
+ response = await middleware.post({
173
+ fetch: this.fetchApi,
174
+ url: fetchParams.url,
175
+ init: fetchParams.init,
176
+ response: response.clone()
177
+ }) || response;
178
+ }
179
+ }
180
+ return response;
181
+ };
182
+ clone() {
183
+ const constructor = this.constructor;
184
+ const next = new constructor(this.configuration);
185
+ next.middleware = this.middleware.slice();
186
+ return next;
187
+ }
188
+ }
189
+ function isBlob(value) {
190
+ return typeof Blob !== "undefined" && value instanceof Blob;
191
+ }
192
+ function isFormData(value) {
193
+ return typeof FormData !== "undefined" && value instanceof FormData;
194
+ }
195
+
196
+ class ResponseError extends Error {
197
+ response;
198
+ name = "ResponseError";
199
+ constructor(response, msg) {
200
+ super(msg);
201
+ this.response = response;
202
+ }
203
+ }
204
+
205
+ class FetchError extends Error {
206
+ cause;
207
+ name = "FetchError";
208
+ constructor(cause, msg) {
209
+ super(msg);
210
+ this.cause = cause;
211
+ }
212
+ }
213
+ function querystring(params, prefix = "") {
214
+ return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
215
+ }
216
+ function querystringSingleKey(key, value, keyPrefix = "") {
217
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
218
+ if (value instanceof Array) {
219
+ const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
220
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
221
+ }
222
+ if (value instanceof Set) {
223
+ const valueAsArray = Array.from(value);
224
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
225
+ }
226
+ if (value instanceof Date) {
227
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
228
+ }
229
+ if (value instanceof Object) {
230
+ return querystring(value, fullKey);
231
+ }
232
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
233
+ }
234
+ // ../solution-sdk/package.json
235
+ var package_default = {
236
+ name: "@uipath/solution-sdk",
237
+ author: "UiPath",
238
+ license: "SEE LICENSE IN LICENSE.txt",
239
+ version: "1.204.0",
240
+ repository: {
241
+ type: "git",
242
+ url: "https://github.com/UiPath/cli.git",
243
+ directory: "packages/solution-sdk"
244
+ },
245
+ publishConfig: {
246
+ registry: "https://npm.pkg.github.com/@uipath"
247
+ },
248
+ keywords: [
249
+ "uipath",
250
+ "solution",
251
+ "sdk"
252
+ ],
253
+ type: "module",
254
+ main: "./dist/index.js",
255
+ types: "./dist/src/index.d.ts",
256
+ exports: {
257
+ ".": {
258
+ types: "./dist/src/index.d.ts",
259
+ default: "./dist/index.js"
260
+ },
261
+ "./resources": {
262
+ types: "./dist/src/resources/index.d.ts",
263
+ default: "./dist/resources/index.js"
264
+ },
265
+ "./auth": {
266
+ types: "./dist/src/solution-auth.d.ts",
267
+ default: "./dist/solution-auth.js"
268
+ }
269
+ },
270
+ bin: {
271
+ "generate-sdk": "./dist/scripts/generate-sdk.js"
272
+ },
273
+ files: [
274
+ "dist"
275
+ ],
276
+ private: false,
277
+ scripts: {
278
+ build: "bun build ./src/index.ts ./src/resources/index.ts ./src/solution-auth.ts --outdir dist --format esm --target node --splitting --sourcemap=linked && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
279
+ generate: "bun run src/scripts/generate-sdk.ts",
280
+ lint: "biome check .",
281
+ test: "vitest run",
282
+ "test:coverage": "vitest run --coverage"
283
+ },
284
+ devDependencies: {
285
+ "@openapitools/openapi-generator-cli": "^2.31.1",
286
+ "@uipath/auth": "workspace:*",
287
+ "@uipath/common": "workspace:*",
288
+ "@uipath/filesystem": "workspace:*",
289
+ "@uipath/orchestrator-sdk": "workspace:*",
290
+ "@uipath/resource-builder-sdk": "2025.11.0-alpha6004-4107",
291
+ "@uipath/solutionpackager-tool-core": "workspace:*",
292
+ "@uipath/studioweb-sdk": "workspace:*",
293
+ "@types/node": "^25.5.2",
294
+ fflate: "^0.8.2",
295
+ typescript: "^7.0.2"
296
+ }
297
+ };
298
+
299
+ // ../solution-sdk/src/user-agent.ts
300
+ var SDK_USER_AGENT = getSdkUserAgentToken(package_default);
301
+ installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
302
+
303
+ // ../studioweb-sdk/generated/src/runtime.ts
304
+ var BASE_PATH2 = "https://alpha.uipath.com/studio_/backend".replace(/\/+$/, "");
305
+
306
+ class Configuration2 {
307
+ configuration;
308
+ constructor(configuration = {}) {
309
+ this.configuration = configuration;
310
+ }
311
+ set config(configuration) {
312
+ this.configuration = configuration;
313
+ }
314
+ get basePath() {
315
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH2;
316
+ }
317
+ get fetchApi() {
318
+ return this.configuration.fetchApi;
319
+ }
320
+ get middleware() {
321
+ return this.configuration.middleware || [];
322
+ }
323
+ get queryParamsStringify() {
324
+ return this.configuration.queryParamsStringify || querystring2;
325
+ }
326
+ get username() {
327
+ return this.configuration.username;
328
+ }
329
+ get password() {
330
+ return this.configuration.password;
331
+ }
332
+ get apiKey() {
333
+ const apiKey = this.configuration.apiKey;
334
+ if (apiKey) {
335
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
336
+ }
337
+ return;
338
+ }
339
+ get accessToken() {
340
+ const accessToken = this.configuration.accessToken;
341
+ if (accessToken) {
342
+ return typeof accessToken === "function" ? accessToken : async () => accessToken;
343
+ }
344
+ return;
345
+ }
346
+ get headers() {
347
+ return this.configuration.headers;
348
+ }
349
+ get credentials() {
350
+ return this.configuration.credentials;
351
+ }
352
+ }
353
+ var DefaultConfig2 = new Configuration2;
354
+
355
+ class BaseAPI2 {
356
+ configuration;
357
+ static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
358
+ middleware;
359
+ constructor(configuration = DefaultConfig2) {
360
+ this.configuration = configuration;
361
+ this.middleware = configuration.middleware;
362
+ }
363
+ withMiddleware(...middlewares) {
364
+ const next = this.clone();
365
+ next.middleware = next.middleware.concat(...middlewares);
366
+ return next;
367
+ }
368
+ withPreMiddleware(...preMiddlewares) {
369
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
370
+ return this.withMiddleware(...middlewares);
371
+ }
372
+ withPostMiddleware(...postMiddlewares) {
373
+ const middlewares = postMiddlewares.map((post) => ({ post }));
374
+ return this.withMiddleware(...middlewares);
375
+ }
376
+ isJsonMime(mime) {
377
+ if (!mime) {
378
+ return false;
379
+ }
380
+ return BaseAPI2.jsonRegex.test(mime);
381
+ }
382
+ async request(context, initOverrides) {
383
+ const { url, init } = await this.createFetchParams(context, initOverrides);
384
+ const response = await this.fetchApi(url, init);
385
+ if (response && (response.status >= 200 && response.status < 300)) {
386
+ return response;
387
+ }
388
+ throw new ResponseError2(response, "Response returned an error code");
389
+ }
390
+ async createFetchParams(context, initOverrides) {
391
+ let url = this.configuration.basePath + context.path;
392
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
393
+ url += "?" + this.configuration.queryParamsStringify(context.query);
394
+ }
395
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
396
+ Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
397
+ const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
398
+ const initParams = {
399
+ method: context.method,
400
+ headers,
401
+ body: context.body,
402
+ credentials: this.configuration.credentials
403
+ };
404
+ const overriddenInit = {
405
+ ...initParams,
406
+ ...await initOverrideFn({
407
+ init: initParams,
408
+ context
409
+ })
410
+ };
411
+ let body;
412
+ if (isFormData2(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob2(overriddenInit.body)) {
413
+ body = overriddenInit.body;
414
+ } else if (this.isJsonMime(headers["Content-Type"])) {
415
+ body = JSON.stringify(overriddenInit.body);
416
+ } else {
417
+ body = overriddenInit.body;
418
+ }
419
+ const init = {
420
+ ...overriddenInit,
421
+ body
422
+ };
423
+ return { url, init };
424
+ }
425
+ fetchApi = async (url, init) => {
426
+ let fetchParams = { url, init };
427
+ for (const middleware of this.middleware) {
428
+ if (middleware.pre) {
429
+ fetchParams = await middleware.pre({
430
+ fetch: this.fetchApi,
431
+ ...fetchParams
432
+ }) || fetchParams;
433
+ }
434
+ }
435
+ let response = undefined;
436
+ try {
437
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
438
+ } catch (e) {
439
+ for (const middleware of this.middleware) {
440
+ if (middleware.onError) {
441
+ response = await middleware.onError({
442
+ fetch: this.fetchApi,
443
+ url: fetchParams.url,
444
+ init: fetchParams.init,
445
+ error: e,
446
+ response: response ? response.clone() : undefined
447
+ }) || response;
448
+ }
449
+ }
450
+ if (response === undefined) {
451
+ if (e instanceof Error) {
452
+ throw new FetchError2(e, "The request failed and the interceptors did not return an alternative response");
453
+ } else {
454
+ throw e;
455
+ }
456
+ }
457
+ }
458
+ for (const middleware of this.middleware) {
459
+ if (middleware.post) {
460
+ response = await middleware.post({
461
+ fetch: this.fetchApi,
462
+ url: fetchParams.url,
463
+ init: fetchParams.init,
464
+ response: response.clone()
465
+ }) || response;
466
+ }
467
+ }
468
+ return response;
469
+ };
470
+ clone() {
471
+ const constructor = this.constructor;
472
+ const next = new constructor(this.configuration);
473
+ next.middleware = this.middleware.slice();
474
+ return next;
475
+ }
476
+ }
477
+ function isBlob2(value) {
478
+ return typeof Blob !== "undefined" && value instanceof Blob;
479
+ }
480
+ function isFormData2(value) {
481
+ return typeof FormData !== "undefined" && value instanceof FormData;
482
+ }
483
+
484
+ class ResponseError2 extends Error {
485
+ response;
486
+ name = "ResponseError";
487
+ constructor(response, msg) {
488
+ super(msg);
489
+ this.response = response;
490
+ }
491
+ }
492
+
493
+ class FetchError2 extends Error {
494
+ cause;
495
+ name = "FetchError";
496
+ constructor(cause, msg) {
497
+ super(msg);
498
+ this.cause = cause;
499
+ }
500
+ }
501
+ function querystring2(params, prefix = "") {
502
+ return Object.keys(params).map((key) => querystringSingleKey2(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
503
+ }
504
+ function querystringSingleKey2(key, value, keyPrefix = "") {
505
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
506
+ if (value instanceof Array) {
507
+ const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
508
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
509
+ }
510
+ if (value instanceof Set) {
511
+ const valueAsArray = Array.from(value);
512
+ return querystringSingleKey2(key, valueAsArray, keyPrefix);
513
+ }
514
+ if (value instanceof Date) {
515
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
516
+ }
517
+ if (value instanceof Object) {
518
+ return querystring2(value, fullKey);
519
+ }
520
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
521
+ }
522
+ // ../solution-sdk/src/studio-web-compat.ts
523
+ var API_PROJECT_TYPES = new Set(["api", "apiautomation"]);
524
+
525
+ // ../solution-sdk/src/zip-utils.ts
526
+ var DEFAULT_EXCLUDED_DIR_NAMES = new Set([
527
+ ".venv",
528
+ "node_modules",
529
+ "__pycache__",
530
+ ".git",
531
+ ".local"
532
+ ]);
533
+ // ../solution-sdk/src/project-debug-status.ts
534
+ var SUCCEEDED = "creationsucceeded";
535
+ var TERMINAL = new Set([SUCCEEDED, "creationfailed", "validationfailed"]);
536
+ // src/services/project-artifacts.ts
537
+ async function ensureProjectArtifacts(args) {
538
+ const { addProjectArtifactsToSolutionAsync } = await import("./index-43zg1wqe.js");
539
+ return addProjectArtifactsToSolutionAsync(args);
540
+ }
541
+
542
+ // src/services/rules-init-service.ts
543
+ var SEEDED_RULE_NAME = "Business rule";
544
+ var SEEDED_DECISION_NAME = "Decision";
545
+ var SEEDED_INPUT_NAME = "input1";
546
+ var SEEDED_OUTPUT_NAME = "output1";
547
+ var formatJson = (value) => `${JSON.stringify(value, null, 2)}
548
+ `;
549
+ var newId = (prefix) => `${prefix}_${crypto.randomUUID()}`;
550
+ var stringArgumentSchema = (argumentName) => ({
551
+ type: "object",
552
+ properties: { [argumentName]: { type: "string", title: argumentName } },
553
+ required: []
554
+ });
555
+ function createSeededRuleFiles() {
556
+ const dmnFileName = `${SEEDED_RULE_NAME}.dmn`;
557
+ const decisionId = newId("decision");
558
+ const inputDataId = newId("inputData");
559
+ const namespace = `http://uipath.com/dmn/${newId("ns")}`;
560
+ const dmn = `<?xml version="1.0" encoding="UTF-8" ?>
561
+ <definitions xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" id="${newId("definitions")}" name="${SEEDED_RULE_NAME}" namespace="${namespace}" exporter="UiPath Maestro" xmlns:tns="${namespace}" xmlns:uipath="http://uipath.com/schema/1.0/dmn/authoring" xmlns:kie="https://kie.org/dmn/extensions/1.0">
562
+ <extensionElements>
563
+ <uipath:authoring surface="decision-table" />
564
+ </extensionElements>
565
+ <decision id="${decisionId}" name="${SEEDED_DECISION_NAME}">
566
+ <extensionElements>
567
+ <uipath:authoring editor="decision-table" />
568
+ </extensionElements>
569
+ <variable id="${newId("variable")}" name="${SEEDED_DECISION_NAME}" typeRef="string" />
570
+ <informationRequirement id="${newId("informationRequirement")}">
571
+ <requiredInput href="#${inputDataId}" />
572
+ </informationRequirement>
573
+ <decisionTable id="${newId("decisionTable")}" hitPolicy="FIRST">
574
+ <input id="${newId("input")}" label="Input 1">
575
+ <inputExpression id="${newId("inputExpression")}" typeRef="string">
576
+ <text>${SEEDED_INPUT_NAME}</text>
577
+ </inputExpression>
578
+ </input>
579
+ <output id="${newId("output")}" label="Output 1" name="${SEEDED_OUTPUT_NAME}" typeRef="string" />
580
+ <rule id="${newId("rule")}">
581
+ <inputEntry id="${newId("inputEntry")}">
582
+ <text>-</text>
583
+ </inputEntry>
584
+ <outputEntry id="${newId("outputEntry")}">
585
+ <text></text>
586
+ </outputEntry>
587
+ </rule>
588
+ </decisionTable>
589
+ </decision>
590
+ <inputData name="${SEEDED_INPUT_NAME}" id="${inputDataId}">
591
+ <variable id="${newId("variable")}" name="${SEEDED_INPUT_NAME}" typeRef="string" />
592
+ </inputData>
593
+ <dmndi:DMNDI>
594
+ <dmndi:DMNDiagram id="DMNDiagram_1">
595
+ <dmndi:DMNShape id="DMNShape_1" dmnElementRef="tns:${decisionId}">
596
+ <dc:Bounds height="80" width="180" x="150" y="80" />
597
+ </dmndi:DMNShape>
598
+ <dmndi:DMNShape id="${newId("DMNShape")}" dmnElementRef="${inputDataId}">
599
+ <dc:Bounds x="486" y="80" width="288" height="96" />
600
+ </dmndi:DMNShape>
601
+ </dmndi:DMNDiagram>
602
+ </dmndi:DMNDI>
603
+ </definitions>
604
+ `;
605
+ const entryPoints = {
606
+ $schema: "https://cloud.uipath.com/draft/2024-12/entry-point",
607
+ $id: "entry-points.json",
608
+ entryPoints: [
609
+ {
610
+ filePath: `/${dmnFileName}#${decisionId}`,
611
+ uniqueId: crypto.randomUUID(),
612
+ type: "BusinessRules",
613
+ displayName: SEEDED_DECISION_NAME,
614
+ input: stringArgumentSchema(SEEDED_INPUT_NAME),
615
+ output: stringArgumentSchema(SEEDED_OUTPUT_NAME)
616
+ }
617
+ ]
618
+ };
619
+ return {
620
+ [dmnFileName]: dmn,
621
+ "entry-points.json": formatJson(entryPoints),
622
+ "bindings_v2.json": formatJson({ version: "2.0", resources: [] })
623
+ };
624
+ }
625
+ var safeMkdir = async (fs, dir) => {
626
+ const [err] = await catchError(fs.mkdir(dir));
627
+ if (err && !(("code" in err) && err.code === "EEXIST")) {
628
+ throw err;
629
+ }
630
+ };
631
+ async function rulesInitAsync(name, options = {}) {
632
+ if (!VALID_PROJECT_NAME_REGEX.test(name)) {
633
+ throw new Error(`Invalid project name "${name}". Name can only contain letters, numbers, underscores (_), and hyphens (-).`);
634
+ }
635
+ const fs = getFileSystem();
636
+ const { projectDir, autoCreatedSolution } = await prepareProjectLocation(fs, fs.path.resolve(name), name, { skipRegistration: options.skipRegistration });
637
+ const [statError] = await catchError(fs.stat(projectDir));
638
+ const projectDirExists = !statError;
639
+ if (statError && !(("code" in statError) && (statError.code === "ENOENT" || statError.code === "PathNotFound"))) {
640
+ throw statError;
641
+ }
642
+ if (projectDirExists && !options.force) {
643
+ const existingEntries = await fs.readdir(projectDir);
644
+ if (existingEntries.length > 0) {
645
+ throw new Error(`Directory "${name}" already exists and is not empty. Use --force to overwrite.`);
646
+ }
647
+ }
648
+ await safeMkdir(fs, projectDir);
649
+ const ruleExists = (await fs.readdir(projectDir)).some((entry) => entry.toLowerCase().endsWith(".dmn"));
650
+ const projectFiles = {
651
+ "project.uiproj": formatJson({
652
+ Name: name,
653
+ ProjectType: "BusinessRules"
654
+ }),
655
+ ...ruleExists ? {} : createSeededRuleFiles()
656
+ };
657
+ for (const [fileName, content] of Object.entries(projectFiles)) {
658
+ await fs.writeFile(fs.path.join(projectDir, fileName), content);
659
+ }
660
+ const registration = await tryRegisterProjectInParentSolution(fs, projectDir, { skipRegistration: options.skipRegistration });
661
+ const projectArtifacts = await maybeGenerateProjectArtifacts(registration, name);
662
+ return {
663
+ projectName: name,
664
+ projectDir,
665
+ registration,
666
+ autoCreatedSolution,
667
+ projectArtifacts,
668
+ ruleStatus: ruleExists ? "Preserved" : "Created"
669
+ };
670
+ }
671
+ async function maybeGenerateProjectArtifacts(registration, projectName) {
672
+ if (registration.Status !== "Registered" && registration.Status !== "AlreadyRegistered" || !registration.Solution || !registration.ProjectId) {
673
+ return;
674
+ }
675
+ const fs = getFileSystem();
676
+ return ensureProjectArtifacts({
677
+ solutionDir: fs.path.dirname(registration.Solution),
678
+ projectId: registration.ProjectId,
679
+ projectName,
680
+ projectType: "BusinessRules"
681
+ });
682
+ }
683
+ export {
684
+ rulesInitAsync
685
+ };
686
+
687
+ //# debugId=A990A36A04FD763B64756E2164756E21