@uipath/apollo-react 6.62.0 → 6.63.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/canvas/components/Guardrails/components/guardrail-evals-toggle.cjs +59 -0
- package/dist/canvas/components/Guardrails/components/guardrail-evals-toggle.d.ts +9 -0
- package/dist/canvas/components/Guardrails/components/guardrail-evals-toggle.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-evals-toggle.js +25 -0
- package/dist/canvas/components/Guardrails/components/guardrail-name-fields.cjs +74 -0
- package/dist/canvas/components/Guardrails/components/guardrail-name-fields.d.ts +12 -0
- package/dist/canvas/components/Guardrails/components/guardrail-name-fields.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-name-fields.js +40 -0
- package/dist/canvas/components/Guardrails/custom-builder-types.cjs +18 -0
- package/dist/canvas/components/Guardrails/custom-builder-types.d.ts +20 -0
- package/dist/canvas/components/Guardrails/custom-builder-types.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/custom-builder-types.js +0 -0
- package/dist/canvas/components/Guardrails/custom-builder-utils.cjs +89 -0
- package/dist/canvas/components/Guardrails/custom-builder-utils.d.ts +25 -0
- package/dist/canvas/components/Guardrails/custom-builder-utils.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/custom-builder-utils.js +49 -0
- package/dist/canvas/components/Guardrails/custom-guardrail-builder.cjs +273 -0
- package/dist/canvas/components/Guardrails/custom-guardrail-builder.d.ts +44 -0
- package/dist/canvas/components/Guardrails/custom-guardrail-builder.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/custom-guardrail-builder.js +239 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.cjs +37 -85
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/guardrail-builder.js +38 -86
- package/dist/canvas/components/Guardrails/i18n.cjs +121 -17
- package/dist/canvas/components/Guardrails/i18n.d.ts +18 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/i18n.js +103 -14
- package/dist/canvas/components/Guardrails/index.cjs +38 -9
- package/dist/canvas/components/Guardrails/index.d.ts +7 -2
- package/dist/canvas/components/Guardrails/index.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/index.js +4 -2
- package/dist/canvas/components/Guardrails/use-guardrail-form-errors.cjs +68 -0
- package/dist/canvas/components/Guardrails/use-guardrail-form-errors.d.ts +15 -0
- package/dist/canvas/components/Guardrails/use-guardrail-form-errors.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-guardrail-form-errors.js +34 -0
- package/dist/canvas/components/Guardrails/use-swallow-enter.cjs +51 -0
- package/dist/canvas/components/Guardrails/use-swallow-enter.d.ts +3 -0
- package/dist/canvas/components/Guardrails/use-swallow-enter.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-swallow-enter.js +17 -0
- package/dist/canvas/locales/de.cjs +1 -1
- package/dist/canvas/locales/de.d.ts.map +1 -1
- package/dist/canvas/locales/de.js +1 -1
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/locales/es-MX.cjs +1 -1
- package/dist/canvas/locales/es-MX.d.ts.map +1 -1
- package/dist/canvas/locales/es-MX.js +1 -1
- package/dist/canvas/locales/es.cjs +1 -1
- package/dist/canvas/locales/es.d.ts.map +1 -1
- package/dist/canvas/locales/es.js +1 -1
- package/dist/canvas/locales/fr.cjs +1 -1
- package/dist/canvas/locales/fr.d.ts.map +1 -1
- package/dist/canvas/locales/fr.js +1 -1
- package/dist/canvas/locales/ja.cjs +1 -1
- package/dist/canvas/locales/ja.d.ts.map +1 -1
- package/dist/canvas/locales/ja.js +1 -1
- package/dist/canvas/locales/ko.cjs +1 -1
- package/dist/canvas/locales/ko.d.ts.map +1 -1
- package/dist/canvas/locales/ko.js +1 -1
- package/dist/canvas/locales/pt-BR.cjs +1 -1
- package/dist/canvas/locales/pt-BR.d.ts.map +1 -1
- package/dist/canvas/locales/pt-BR.js +1 -1
- package/dist/canvas/locales/pt.cjs +1 -1
- package/dist/canvas/locales/pt.d.ts.map +1 -1
- package/dist/canvas/locales/pt.js +1 -1
- package/dist/canvas/locales/ro.cjs +1 -1
- package/dist/canvas/locales/ro.d.ts.map +1 -1
- package/dist/canvas/locales/ro.js +1 -1
- package/dist/canvas/locales/tr.cjs +1 -1
- package/dist/canvas/locales/tr.d.ts.map +1 -1
- package/dist/canvas/locales/tr.js +1 -1
- package/dist/canvas/locales/zh-CN.cjs +1 -1
- package/dist/canvas/locales/zh-CN.d.ts.map +1 -1
- package/dist/canvas/locales/zh-CN.js +1 -1
- package/dist/canvas/locales/zh-TW.cjs +1 -1
- package/dist/canvas/locales/zh-TW.d.ts.map +1 -1
- package/dist/canvas/locales/zh-TW.js +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
GuardrailEvalsToggle: ()=>GuardrailEvalsToggle
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
|
+
function GuardrailEvalsToggle({ idPrefix, checked, onCheckedChange, labels }) {
|
|
32
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
33
|
+
className: "flex items-center gap-2",
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Switch, {
|
|
36
|
+
id: `${idPrefix}-enable-evals`,
|
|
37
|
+
checked: checked,
|
|
38
|
+
onCheckedChange: onCheckedChange
|
|
39
|
+
}),
|
|
40
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Label, {
|
|
41
|
+
variant: "muted",
|
|
42
|
+
htmlFor: `${idPrefix}-enable-evals`,
|
|
43
|
+
className: "cursor-pointer",
|
|
44
|
+
children: labels.evalsLabel
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.InfoTooltip, {
|
|
47
|
+
content: labels.evalsTooltip,
|
|
48
|
+
"aria-label": labels.evalsInfoAriaLabel
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.GuardrailEvalsToggle = __webpack_exports__.GuardrailEvalsToggle;
|
|
54
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
55
|
+
"GuardrailEvalsToggle"
|
|
56
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
57
|
+
Object.defineProperty(exports, '__esModule', {
|
|
58
|
+
value: true
|
|
59
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GuardrailBuilderLabels } from '../i18n';
|
|
2
|
+
export interface GuardrailEvalsToggleProps {
|
|
3
|
+
idPrefix: string;
|
|
4
|
+
checked: boolean;
|
|
5
|
+
onCheckedChange: (checked: boolean) => void;
|
|
6
|
+
labels: Pick<GuardrailBuilderLabels, 'evalsLabel' | 'evalsTooltip' | 'evalsInfoAriaLabel'>;
|
|
7
|
+
}
|
|
8
|
+
export declare function GuardrailEvalsToggle({ idPrefix, checked, onCheckedChange, labels, }: GuardrailEvalsToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=guardrail-evals-toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardrail-evals-toggle.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/guardrail-evals-toggle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,yBAAyB;IAExC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,MAAM,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,GAAG,cAAc,GAAG,oBAAoB,CAAC,CAAC;CAC5F;AAGD,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,OAAO,EACP,eAAe,EACf,MAAM,GACP,EAAE,yBAAyB,2CAU3B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { InfoTooltip, Label, Switch } from "@uipath/apollo-wind";
|
|
3
|
+
function GuardrailEvalsToggle({ idPrefix, checked, onCheckedChange, labels }) {
|
|
4
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
5
|
+
className: "flex items-center gap-2",
|
|
6
|
+
children: [
|
|
7
|
+
/*#__PURE__*/ jsx(Switch, {
|
|
8
|
+
id: `${idPrefix}-enable-evals`,
|
|
9
|
+
checked: checked,
|
|
10
|
+
onCheckedChange: onCheckedChange
|
|
11
|
+
}),
|
|
12
|
+
/*#__PURE__*/ jsx(Label, {
|
|
13
|
+
variant: "muted",
|
|
14
|
+
htmlFor: `${idPrefix}-enable-evals`,
|
|
15
|
+
className: "cursor-pointer",
|
|
16
|
+
children: labels.evalsLabel
|
|
17
|
+
}),
|
|
18
|
+
/*#__PURE__*/ jsx(InfoTooltip, {
|
|
19
|
+
content: labels.evalsTooltip,
|
|
20
|
+
"aria-label": labels.evalsInfoAriaLabel
|
|
21
|
+
})
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export { GuardrailEvalsToggle };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
GuardrailNameFields: ()=>GuardrailNameFields
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
|
+
function GuardrailNameFields({ idPrefix, name, description, onNameChange, onDescriptionChange, nameError, labels }) {
|
|
32
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
|
|
35
|
+
children: [
|
|
36
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.FormFieldLabel, {
|
|
37
|
+
htmlFor: `${idPrefix}-name`,
|
|
38
|
+
required: true,
|
|
39
|
+
children: labels.nameLabel
|
|
40
|
+
}),
|
|
41
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Input, {
|
|
42
|
+
id: `${idPrefix}-name`,
|
|
43
|
+
value: name,
|
|
44
|
+
onChange: (e)=>onNameChange(e.target.value),
|
|
45
|
+
placeholder: labels.namePlaceholder,
|
|
46
|
+
error: nameError
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
}),
|
|
50
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Label, {
|
|
53
|
+
htmlFor: `${idPrefix}-description`,
|
|
54
|
+
children: labels.descriptionLabel
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Textarea, {
|
|
57
|
+
id: `${idPrefix}-description`,
|
|
58
|
+
minRows: 1,
|
|
59
|
+
value: description,
|
|
60
|
+
onChange: (e)=>onDescriptionChange(e.target.value),
|
|
61
|
+
placeholder: labels.descriptionPlaceholder
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
exports.GuardrailNameFields = __webpack_exports__.GuardrailNameFields;
|
|
69
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
70
|
+
"GuardrailNameFields"
|
|
71
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
72
|
+
Object.defineProperty(exports, '__esModule', {
|
|
73
|
+
value: true
|
|
74
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GuardrailBuilderLabels } from '../i18n';
|
|
2
|
+
export interface GuardrailNameFieldsProps {
|
|
3
|
+
idPrefix: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
onNameChange: (name: string) => void;
|
|
7
|
+
onDescriptionChange: (description: string) => void;
|
|
8
|
+
nameError?: string;
|
|
9
|
+
labels: Pick<GuardrailBuilderLabels, 'nameLabel' | 'namePlaceholder' | 'descriptionLabel' | 'descriptionPlaceholder'>;
|
|
10
|
+
}
|
|
11
|
+
export declare function GuardrailNameFields({ idPrefix, name, description, onNameChange, onDescriptionChange, nameError, labels, }: GuardrailNameFieldsProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=guardrail-name-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardrail-name-fields.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/guardrail-name-fields.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,wBAAwB;IAEvC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,mBAAmB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,IAAI,CACV,sBAAsB,EACtB,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,wBAAwB,CAChF,CAAC;CACH;AAGD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,MAAM,GACP,EAAE,wBAAwB,2CA8B1B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FormField, FormFieldLabel, Input, Label, Textarea } from "@uipath/apollo-wind";
|
|
3
|
+
function GuardrailNameFields({ idPrefix, name, description, onNameChange, onDescriptionChange, nameError, labels }) {
|
|
4
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
5
|
+
children: [
|
|
6
|
+
/*#__PURE__*/ jsxs(FormField, {
|
|
7
|
+
children: [
|
|
8
|
+
/*#__PURE__*/ jsx(FormFieldLabel, {
|
|
9
|
+
htmlFor: `${idPrefix}-name`,
|
|
10
|
+
required: true,
|
|
11
|
+
children: labels.nameLabel
|
|
12
|
+
}),
|
|
13
|
+
/*#__PURE__*/ jsx(Input, {
|
|
14
|
+
id: `${idPrefix}-name`,
|
|
15
|
+
value: name,
|
|
16
|
+
onChange: (e)=>onNameChange(e.target.value),
|
|
17
|
+
placeholder: labels.namePlaceholder,
|
|
18
|
+
error: nameError
|
|
19
|
+
})
|
|
20
|
+
]
|
|
21
|
+
}),
|
|
22
|
+
/*#__PURE__*/ jsxs(FormField, {
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ jsx(Label, {
|
|
25
|
+
htmlFor: `${idPrefix}-description`,
|
|
26
|
+
children: labels.descriptionLabel
|
|
27
|
+
}),
|
|
28
|
+
/*#__PURE__*/ jsx(Textarea, {
|
|
29
|
+
id: `${idPrefix}-description`,
|
|
30
|
+
minRows: 1,
|
|
31
|
+
value: description,
|
|
32
|
+
onChange: (e)=>onDescriptionChange(e.target.value),
|
|
33
|
+
placeholder: labels.descriptionPlaceholder
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export { GuardrailNameFields };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GuardrailAction, GuardrailBuilderErrors, GuardrailSelector } from './builder-types';
|
|
2
|
+
import type { GuardrailFieldReference, GuardrailRule, GuardrailRulesErrors } from './rules-types';
|
|
3
|
+
export type CustomGuardrailAction = Exclude<GuardrailAction, {
|
|
4
|
+
$actionType: 'filter';
|
|
5
|
+
}> | {
|
|
6
|
+
$actionType: 'filter';
|
|
7
|
+
fields: GuardrailFieldReference[];
|
|
8
|
+
};
|
|
9
|
+
export interface CustomGuardrailBuilderValue {
|
|
10
|
+
id: string;
|
|
11
|
+
$guardrailType: 'custom';
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
selector: GuardrailSelector;
|
|
15
|
+
action: CustomGuardrailAction;
|
|
16
|
+
enabledForEvals: boolean;
|
|
17
|
+
rules: GuardrailRule[];
|
|
18
|
+
}
|
|
19
|
+
export type CustomGuardrailBuilderErrors = Pick<GuardrailBuilderErrors, 'name' | 'blockReason' | 'filterFields' | 'recipient' | 'actionApp'> & GuardrailRulesErrors;
|
|
20
|
+
//# sourceMappingURL=custom-builder-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-builder-types.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/custom-builder-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,KAAK,EAAE,uBAAuB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAWlG,MAAM,MAAM,qBAAqB,GAC7B,OAAO,CAAC,eAAe,EAAE;IAAE,WAAW,EAAE,QAAQ,CAAA;CAAE,CAAC,GACnD;IAAE,WAAW,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,uBAAuB,EAAE,CAAA;CAAE,CAAC;AAGjE,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,QAAQ,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAMD,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAC7C,sBAAsB,EACtB,MAAM,GAAG,aAAa,GAAG,cAAc,GAAG,WAAW,GAAG,WAAW,CACpE,GACC,oBAAoB,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
initCustomGuardrailBuilderFormData: ()=>initCustomGuardrailBuilderFormData,
|
|
28
|
+
createDefaultCustomGuardrail: ()=>createDefaultCustomGuardrail,
|
|
29
|
+
getCustomGuardrailErrorFields: ()=>getCustomGuardrailErrorFields
|
|
30
|
+
});
|
|
31
|
+
const external_builder_utils_cjs_namespaceObject = require("./builder-utils.cjs");
|
|
32
|
+
const external_rules_utils_cjs_namespaceObject = require("./rules-utils.cjs");
|
|
33
|
+
function createDefaultCustomGuardrail(toolName) {
|
|
34
|
+
return {
|
|
35
|
+
id: (0, external_builder_utils_cjs_namespaceObject.generateGuardrailId)(),
|
|
36
|
+
$guardrailType: 'custom',
|
|
37
|
+
name: '',
|
|
38
|
+
selector: {
|
|
39
|
+
scopes: [
|
|
40
|
+
'Tool'
|
|
41
|
+
],
|
|
42
|
+
...toolName ? {
|
|
43
|
+
matchNames: [
|
|
44
|
+
toolName
|
|
45
|
+
]
|
|
46
|
+
} : {}
|
|
47
|
+
},
|
|
48
|
+
action: {
|
|
49
|
+
$actionType: 'log',
|
|
50
|
+
severityLevel: 'Info'
|
|
51
|
+
},
|
|
52
|
+
enabledForEvals: true,
|
|
53
|
+
rules: [
|
|
54
|
+
(0, external_rules_utils_cjs_namespaceObject.createGuardrailRule)('always')
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function getCustomGuardrailErrorFields(guardrail, existingNames) {
|
|
59
|
+
const name = guardrail.name.trim();
|
|
60
|
+
return {
|
|
61
|
+
name: name ? existingNames?.some((n)=>n.toLowerCase() === name.toLowerCase()) ? 'duplicate' : void 0 : 'required',
|
|
62
|
+
rules: (0, external_rules_utils_cjs_namespaceObject.getGuardrailRulesErrorFields)(guardrail.rules),
|
|
63
|
+
perRule: guardrail.rules.map(external_rules_utils_cjs_namespaceObject.getGuardrailRuleErrorFields),
|
|
64
|
+
action: (0, external_builder_utils_cjs_namespaceObject.getGuardrailActionErrorFields)(guardrail.action)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function initCustomGuardrailBuilderFormData(existing, toolName) {
|
|
68
|
+
const source = existing ?? createDefaultCustomGuardrail(toolName);
|
|
69
|
+
return {
|
|
70
|
+
id: source.id,
|
|
71
|
+
name: source.name,
|
|
72
|
+
description: source.description ?? '',
|
|
73
|
+
selector: source.selector,
|
|
74
|
+
action: source.action,
|
|
75
|
+
enabledForEvals: source.enabledForEvals,
|
|
76
|
+
rules: source.rules
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
exports.createDefaultCustomGuardrail = __webpack_exports__.createDefaultCustomGuardrail;
|
|
80
|
+
exports.getCustomGuardrailErrorFields = __webpack_exports__.getCustomGuardrailErrorFields;
|
|
81
|
+
exports.initCustomGuardrailBuilderFormData = __webpack_exports__.initCustomGuardrailBuilderFormData;
|
|
82
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
83
|
+
"createDefaultCustomGuardrail",
|
|
84
|
+
"getCustomGuardrailErrorFields",
|
|
85
|
+
"initCustomGuardrailBuilderFormData"
|
|
86
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
87
|
+
Object.defineProperty(exports, '__esModule', {
|
|
88
|
+
value: true
|
|
89
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { GuardrailSelector } from './builder-types';
|
|
2
|
+
import { type GuardrailActionErrorField } from './builder-utils';
|
|
3
|
+
import type { CustomGuardrailAction, CustomGuardrailBuilderValue } from './custom-builder-types';
|
|
4
|
+
import type { GuardrailRule } from './rules-types';
|
|
5
|
+
import { type GuardrailRuleErrorField, type GuardrailRulesErrorField } from './rules-utils';
|
|
6
|
+
export declare function createDefaultCustomGuardrail(toolName?: string): CustomGuardrailBuilderValue;
|
|
7
|
+
export type CustomGuardrailNameErrorField = 'required' | 'duplicate';
|
|
8
|
+
export interface CustomGuardrailErrorFields {
|
|
9
|
+
name?: CustomGuardrailNameErrorField;
|
|
10
|
+
rules: GuardrailRulesErrorField[];
|
|
11
|
+
perRule: GuardrailRuleErrorField[][];
|
|
12
|
+
action: GuardrailActionErrorField[];
|
|
13
|
+
}
|
|
14
|
+
export declare function getCustomGuardrailErrorFields(guardrail: Pick<CustomGuardrailBuilderValue, 'name' | 'rules' | 'action'>, existingNames?: readonly string[]): CustomGuardrailErrorFields;
|
|
15
|
+
export interface CustomGuardrailBuilderFormData {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
selector: GuardrailSelector;
|
|
20
|
+
action: CustomGuardrailAction;
|
|
21
|
+
enabledForEvals: boolean;
|
|
22
|
+
rules: GuardrailRule[];
|
|
23
|
+
}
|
|
24
|
+
export declare function initCustomGuardrailBuilderFormData(existing?: CustomGuardrailBuilderValue, toolName?: string): CustomGuardrailBuilderFormData;
|
|
25
|
+
//# sourceMappingURL=custom-builder-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-builder-utils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/custom-builder-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EACL,KAAK,yBAAyB,EAG/B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAG9B,MAAM,eAAe,CAAC;AAOvB,wBAAgB,4BAA4B,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,2BAA2B,CAU3F;AAGD,MAAM,MAAM,6BAA6B,GAAG,UAAU,GAAG,WAAW,CAAC;AAErE,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,6BAA6B,CAAC;IAErC,KAAK,EAAE,wBAAwB,EAAE,CAAC;IAElC,OAAO,EAAE,uBAAuB,EAAE,EAAE,CAAC;IACrC,MAAM,EAAE,yBAAyB,EAAE,CAAC;CACrC;AAGD,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,IAAI,CAAC,2BAA2B,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC,EACzE,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,GAChC,0BAA0B,CAY5B;AAED,MAAM,WAAW,8BAA8B;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAQD,wBAAgB,kCAAkC,CAChD,QAAQ,CAAC,EAAE,2BAA2B,EACtC,QAAQ,CAAC,EAAE,MAAM,GAChB,8BAA8B,CAWhC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { generateGuardrailId, getGuardrailActionErrorFields } from "./builder-utils.js";
|
|
2
|
+
import { createGuardrailRule, getGuardrailRuleErrorFields, getGuardrailRulesErrorFields } from "./rules-utils.js";
|
|
3
|
+
function createDefaultCustomGuardrail(toolName) {
|
|
4
|
+
return {
|
|
5
|
+
id: generateGuardrailId(),
|
|
6
|
+
$guardrailType: 'custom',
|
|
7
|
+
name: '',
|
|
8
|
+
selector: {
|
|
9
|
+
scopes: [
|
|
10
|
+
'Tool'
|
|
11
|
+
],
|
|
12
|
+
...toolName ? {
|
|
13
|
+
matchNames: [
|
|
14
|
+
toolName
|
|
15
|
+
]
|
|
16
|
+
} : {}
|
|
17
|
+
},
|
|
18
|
+
action: {
|
|
19
|
+
$actionType: 'log',
|
|
20
|
+
severityLevel: 'Info'
|
|
21
|
+
},
|
|
22
|
+
enabledForEvals: true,
|
|
23
|
+
rules: [
|
|
24
|
+
createGuardrailRule('always')
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function getCustomGuardrailErrorFields(guardrail, existingNames) {
|
|
29
|
+
const name = guardrail.name.trim();
|
|
30
|
+
return {
|
|
31
|
+
name: name ? existingNames?.some((n)=>n.toLowerCase() === name.toLowerCase()) ? 'duplicate' : void 0 : 'required',
|
|
32
|
+
rules: getGuardrailRulesErrorFields(guardrail.rules),
|
|
33
|
+
perRule: guardrail.rules.map(getGuardrailRuleErrorFields),
|
|
34
|
+
action: getGuardrailActionErrorFields(guardrail.action)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function initCustomGuardrailBuilderFormData(existing, toolName) {
|
|
38
|
+
const source = existing ?? createDefaultCustomGuardrail(toolName);
|
|
39
|
+
return {
|
|
40
|
+
id: source.id,
|
|
41
|
+
name: source.name,
|
|
42
|
+
description: source.description ?? '',
|
|
43
|
+
selector: source.selector,
|
|
44
|
+
action: source.action,
|
|
45
|
+
enabledForEvals: source.enabledForEvals,
|
|
46
|
+
rules: source.rules
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export { createDefaultCustomGuardrail, getCustomGuardrailErrorFields, initCustomGuardrailBuilderFormData };
|