@uipath/guardrails-tool 1.200.0-preview.120 → 1.200.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tool.js CHANGED
@@ -2110,7 +2110,7 @@ var require_commander = __commonJS((exports) => {
2110
2110
  var package_default = {
2111
2111
  name: "@uipath/guardrails-tool",
2112
2112
  license: "MIT",
2113
- version: "1.200.0-preview.120",
2113
+ version: "1.200.0",
2114
2114
  description: "CLI plugin for UiPath AI Trust Layer guardrail configurations.",
2115
2115
  private: false,
2116
2116
  repository: {
@@ -10931,4 +10931,4 @@ export {
10931
10931
  metadata
10932
10932
  };
10933
10933
 
10934
- //# debugId=9A1DDC4790F996B164756E2164756E21
10934
+ //# debugId=380A3FC1AB333A2764756E2164756E21
package/package.json CHANGED
@@ -1,34 +1,27 @@
1
1
  {
2
- "name": "@uipath/guardrails-tool",
3
- "license": "MIT",
4
- "version": "1.200.0-preview.120",
5
- "description": "CLI plugin for UiPath AI Trust Layer guardrail configurations.",
6
- "private": false,
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/UiPath/cli.git",
10
- "directory": "packages/admin/guardrails-tool"
11
- },
12
- "publishConfig": {
13
- "registry": "https://registry.npmjs.org/"
14
- },
15
- "keywords": [
16
- "cli-tool"
17
- ],
18
- "type": "module",
19
- "main": "./dist/tool.js",
20
- "exports": {
21
- ".": "./dist/tool.js"
22
- },
23
- "files": [
24
- "dist"
25
- ],
26
- "devDependencies": {
27
- "@types/bun": "^1.3.11",
28
- "@uipath/auth": "1.200.0",
29
- "@uipath/common": "1.200.0",
30
- "commander": "^14.0.3",
31
- "typescript": "^6.0.2"
32
- },
33
- "gitHead": "173ad4b4930bd3e17a493b32e9f1c3c616ea1c10"
2
+ "name": "@uipath/guardrails-tool",
3
+ "license": "MIT",
4
+ "version": "1.200.0",
5
+ "description": "CLI plugin for UiPath AI Trust Layer guardrail configurations.",
6
+ "private": false,
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/UiPath/cli.git",
10
+ "directory": "packages/admin/guardrails-tool"
11
+ },
12
+ "publishConfig": {
13
+ "registry": "https://registry.npmjs.org/"
14
+ },
15
+ "keywords": [
16
+ "cli-tool"
17
+ ],
18
+ "type": "module",
19
+ "main": "./dist/tool.js",
20
+ "exports": {
21
+ ".": "./dist/tool.js"
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "gitHead": "173ad4b4930bd3e17a493b32e9f1c3c616ea1c10"
34
27
  }
@@ -1,99 +0,0 @@
1
- import {
2
- getGlobalThis
3
- } from "./tool-eb3gcj08.js";
4
- import {
5
- AUTH_CANCELLED_ERROR_CODE
6
- } from "./tool-yy8n2117.js";
7
- import"./tool-0v6na3yp.js";
8
-
9
- // ../../auth/src/strategies/browser-strategy.ts
10
- class BrowserAuthStrategy {
11
- async execute(url, _redirectUri, expectedState, opts) {
12
- const global = getGlobalThis();
13
- if (!global?.window) {
14
- throw new Error("Browser environment required for authentication");
15
- }
16
- const screenWidth = global.window.screen?.width ?? 1024;
17
- const screenHeight = global.window.screen?.height ?? 768;
18
- const width = 600;
19
- const height = 700;
20
- const left = screenWidth / 2 - width / 2;
21
- const top = screenHeight / 2 - height / 2;
22
- if (!global.window.open) {
23
- throw new Error("window.open is not available");
24
- }
25
- const popupResult = global.window.open(url, "uip_auth", `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes,status=yes`);
26
- const popup = popupResult;
27
- if (!popup) {
28
- throw new Error(`Authentication popup was blocked by your browser.
29
-
30
- ` + `To continue:
31
- ` + `1. Look for a popup blocker icon in your address bar
32
- ` + `2. Allow popups for this site
33
- ` + `3. Try logging in again
34
-
35
- ` + "If using an ad blocker, you may need to temporarily disable it.");
36
- }
37
- return new Promise((resolve, reject) => {
38
- let timer;
39
- const messageHandler = (event) => {
40
- if (event.data?.type === "UIP_AUTH_CODE" && event.data.code) {
41
- if (event.data.state !== expectedState) {
42
- cleanup();
43
- reject(new Error("OAuth state mismatch — the callback state does not match the expected value. " + "This may indicate a CSRF attack. Please try signing in again."));
44
- popup.close();
45
- return;
46
- }
47
- cleanup();
48
- resolve(event.data.code);
49
- popup.close();
50
- } else if (event.data?.type === "UIP_AUTH_ERROR") {
51
- cleanup();
52
- const errorMsg = event.data.error || "Authentication failed";
53
- reject(new Error(`Authentication failed: ${errorMsg}
54
-
55
- ` + "Please check your credentials and try again. " + "If the problem persists, verify your UiPath account is active."));
56
- popup.close();
57
- }
58
- };
59
- const cleanup = () => {
60
- global.window?.removeEventListener?.("message", messageHandler);
61
- opts?.signal?.removeEventListener("abort", onAbort);
62
- if (timer)
63
- clearInterval(timer);
64
- };
65
- const onAbort = () => {
66
- cleanup();
67
- const err = new Error(`Authentication was cancelled.
68
-
69
- ` + "The sign-in was cancelled before completing the login process. " + "Please try again and complete the authentication flow.");
70
- err.code = AUTH_CANCELLED_ERROR_CODE;
71
- reject(err);
72
- popup.close();
73
- };
74
- if (opts?.signal) {
75
- if (opts.signal.aborted) {
76
- onAbort();
77
- return;
78
- }
79
- opts.signal.addEventListener("abort", onAbort, { once: true });
80
- }
81
- if (global.window?.addEventListener) {
82
- global.window.addEventListener("message", messageHandler);
83
- }
84
- timer = setInterval(() => {
85
- if (popup.closed) {
86
- cleanup();
87
- reject(new Error(`Authentication was cancelled.
88
-
89
- ` + "The authentication popup was closed before completing the login process. " + "Please try again and complete the authentication flow."));
90
- }
91
- }, 1000);
92
- });
93
- }
94
- }
95
- export {
96
- BrowserAuthStrategy
97
- };
98
-
99
- //# debugId=7E6CB2E71E11FBC864756E2164756E21