@uipath/apollo-react 6.45.3 → 6.46.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/builder-types.cjs +47 -0
- package/dist/canvas/components/Guardrails/builder-types.d.ts +129 -0
- package/dist/canvas/components/Guardrails/builder-types.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/builder-types.js +10 -0
- package/dist/canvas/components/Guardrails/builder-utils.cjs +144 -0
- package/dist/canvas/components/Guardrails/builder-utils.d.ts +18 -0
- package/dist/canvas/components/Guardrails/builder-utils.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/builder-utils.js +98 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.cjs +85 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.d.ts +3 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.js +51 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.cjs +268 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.d.ts +23 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.js +234 -0
- package/dist/canvas/components/Guardrails/components/field-shell.cjs +46 -0
- package/dist/canvas/components/Guardrails/components/field-shell.d.ts +7 -0
- package/dist/canvas/components/Guardrails/components/field-shell.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/field-shell.js +12 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.cjs +173 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.d.ts +22 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.js +139 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.cjs +63 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.d.ts +11 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.js +26 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.cjs +217 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.d.ts +15 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.js +183 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.cjs +61 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.d.ts +6 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.js +27 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.cjs +116 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.d.ts +3 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.js +82 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.cjs +69 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.d.ts +10 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.js +35 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.cjs +60 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.d.ts +11 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.js +26 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.cjs +246 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.d.ts +15 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.js +197 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.cjs +369 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts +41 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.js +335 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.cjs +138 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.d.ts +24 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.js +104 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.cjs +199 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.d.ts +3 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.js +165 -0
- package/dist/canvas/components/Guardrails/i18n.cjs +436 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts +76 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/i18n.js +384 -0
- package/dist/canvas/components/Guardrails/index.cjs +112 -0
- package/dist/canvas/components/Guardrails/index.d.ts +16 -0
- package/dist/canvas/components/Guardrails/index.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/index.js +9 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.cjs +60 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.d.ts +13 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.js +23 -0
- package/dist/canvas/components/Guardrails/types.cjs +18 -0
- package/dist/canvas/components/Guardrails/types.d.ts +69 -0
- package/dist/canvas/components/Guardrails/types.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/types.js +0 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.cjs +144 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.d.ts +13 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.js +110 -0
- package/dist/canvas/components/Guardrails/utils.cjs +174 -0
- package/dist/canvas/components/Guardrails/utils.d.ts +9 -0
- package/dist/canvas/components/Guardrails/utils.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/utils.js +122 -0
- package/dist/canvas/components/index.cjs +41 -34
- package/dist/canvas/components/index.d.ts +1 -0
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +1 -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/ru.cjs +1 -1
- package/dist/canvas/locales/ru.d.ts.map +1 -1
- package/dist/canvas/locales/ru.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/dist/i18n/index.cjs +5 -1
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +2 -1
- package/dist/test/setup.d.ts.map +1 -1
- package/package.json +11 -3
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
GUARDRAIL_BYO_VALIDATOR_TYPE: ()=>GUARDRAIL_BYO_VALIDATOR_TYPE,
|
|
28
|
+
GuardrailRecipientType: ()=>GuardrailRecipientType
|
|
29
|
+
});
|
|
30
|
+
const GuardrailRecipientType = {
|
|
31
|
+
User: 1,
|
|
32
|
+
Group: 2,
|
|
33
|
+
StaticEmail: 3,
|
|
34
|
+
AssetEmail: 4,
|
|
35
|
+
StaticGroupName: 5,
|
|
36
|
+
AssetGroupName: 6
|
|
37
|
+
};
|
|
38
|
+
const GUARDRAIL_BYO_VALIDATOR_TYPE = 'byo';
|
|
39
|
+
exports.GUARDRAIL_BYO_VALIDATOR_TYPE = __webpack_exports__.GUARDRAIL_BYO_VALIDATOR_TYPE;
|
|
40
|
+
exports.GuardrailRecipientType = __webpack_exports__.GuardrailRecipientType;
|
|
41
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
42
|
+
"GUARDRAIL_BYO_VALIDATOR_TYPE",
|
|
43
|
+
"GuardrailRecipientType"
|
|
44
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
45
|
+
Object.defineProperty(exports, '__esModule', {
|
|
46
|
+
value: true
|
|
47
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { GuardrailParameterDefinition, GuardrailValidatorParameter } from './types';
|
|
3
|
+
export type GuardrailScope = 'Agent' | 'Llm' | 'Tool';
|
|
4
|
+
export interface GuardrailSelector {
|
|
5
|
+
scopes: GuardrailScope[];
|
|
6
|
+
matchNames?: string[];
|
|
7
|
+
}
|
|
8
|
+
export type GuardrailSeverityLevel = 'Info' | 'Warning' | 'Error';
|
|
9
|
+
export declare const GuardrailRecipientType: {
|
|
10
|
+
readonly User: 1;
|
|
11
|
+
readonly Group: 2;
|
|
12
|
+
readonly StaticEmail: 3;
|
|
13
|
+
readonly AssetEmail: 4;
|
|
14
|
+
readonly StaticGroupName: 5;
|
|
15
|
+
readonly AssetGroupName: 6;
|
|
16
|
+
};
|
|
17
|
+
export type GuardrailRecipientTypeValue = (typeof GuardrailRecipientType)[keyof typeof GuardrailRecipientType];
|
|
18
|
+
export type GuardrailEscalateRecipient = {
|
|
19
|
+
type: 1;
|
|
20
|
+
value: string;
|
|
21
|
+
displayName: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: 2;
|
|
24
|
+
value: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: 3;
|
|
28
|
+
value: string;
|
|
29
|
+
} | {
|
|
30
|
+
type: 4;
|
|
31
|
+
folderPath?: string;
|
|
32
|
+
assetName: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: 5;
|
|
35
|
+
value: string;
|
|
36
|
+
} | {
|
|
37
|
+
type: 6;
|
|
38
|
+
folderPath?: string;
|
|
39
|
+
assetName: string;
|
|
40
|
+
};
|
|
41
|
+
export interface GuardrailEscalateApp {
|
|
42
|
+
id: string;
|
|
43
|
+
version: string;
|
|
44
|
+
name: string;
|
|
45
|
+
folderId?: string;
|
|
46
|
+
folderName?: string;
|
|
47
|
+
appProcessKey?: string;
|
|
48
|
+
runtime?: string;
|
|
49
|
+
}
|
|
50
|
+
export type GuardrailAction = {
|
|
51
|
+
$actionType: 'log';
|
|
52
|
+
severityLevel: GuardrailSeverityLevel;
|
|
53
|
+
} | {
|
|
54
|
+
$actionType: 'block';
|
|
55
|
+
reason: string;
|
|
56
|
+
} | {
|
|
57
|
+
$actionType: 'filter';
|
|
58
|
+
fields: unknown[];
|
|
59
|
+
} | {
|
|
60
|
+
$actionType: 'escalate';
|
|
61
|
+
app: GuardrailEscalateApp;
|
|
62
|
+
recipient: GuardrailEscalateRecipient;
|
|
63
|
+
};
|
|
64
|
+
export type GuardrailDefinitionStatus = 'Available' | 'FeatureDisabled' | 'Unauthorised' | 'Disabled';
|
|
65
|
+
export interface GuardrailDefinition {
|
|
66
|
+
validator: string;
|
|
67
|
+
displayName: string;
|
|
68
|
+
allowedScopes: GuardrailScope[];
|
|
69
|
+
parameters: GuardrailParameterDefinition[];
|
|
70
|
+
status: GuardrailDefinitionStatus;
|
|
71
|
+
usageNote?: React.ReactNode;
|
|
72
|
+
byoValidatorName?: string;
|
|
73
|
+
}
|
|
74
|
+
export declare const GUARDRAIL_BYO_VALIDATOR_TYPE = "byo";
|
|
75
|
+
export interface GuardrailBuilderValue {
|
|
76
|
+
id: string;
|
|
77
|
+
$guardrailType: 'builtInValidator';
|
|
78
|
+
name: string;
|
|
79
|
+
description?: string;
|
|
80
|
+
selector: GuardrailSelector;
|
|
81
|
+
action: GuardrailAction;
|
|
82
|
+
enabledForEvals: boolean;
|
|
83
|
+
validatorType: string;
|
|
84
|
+
validatorParameters: GuardrailValidatorParameter[];
|
|
85
|
+
byoValidatorName?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface GuardrailBuilderErrors {
|
|
88
|
+
name?: string;
|
|
89
|
+
blockReason?: string;
|
|
90
|
+
filterFields?: string;
|
|
91
|
+
recipient?: string;
|
|
92
|
+
actionApp?: string;
|
|
93
|
+
scopes?: string;
|
|
94
|
+
toolNames?: string;
|
|
95
|
+
parameters?: Record<string, string>;
|
|
96
|
+
}
|
|
97
|
+
export interface GuardrailRecipientSearchContext {
|
|
98
|
+
kind: 'user' | 'group';
|
|
99
|
+
displayValue: string;
|
|
100
|
+
placeholder: string;
|
|
101
|
+
invalid: boolean;
|
|
102
|
+
error?: string;
|
|
103
|
+
onSelect: (selection: {
|
|
104
|
+
value: string;
|
|
105
|
+
displayName: string;
|
|
106
|
+
}) => void;
|
|
107
|
+
onClear: () => void;
|
|
108
|
+
}
|
|
109
|
+
export interface GuardrailAppPickerContext {
|
|
110
|
+
app: GuardrailEscalateApp | null;
|
|
111
|
+
onChange: (app: GuardrailEscalateApp | null) => void;
|
|
112
|
+
label: string;
|
|
113
|
+
error?: string;
|
|
114
|
+
}
|
|
115
|
+
export interface GuardrailStaticRecipientContext {
|
|
116
|
+
kind: 'email' | 'groupName';
|
|
117
|
+
recipient: GuardrailEscalateRecipient;
|
|
118
|
+
label: string;
|
|
119
|
+
invalid: boolean;
|
|
120
|
+
error?: string;
|
|
121
|
+
onChange: (recipient: GuardrailEscalateRecipient) => void;
|
|
122
|
+
}
|
|
123
|
+
export interface GuardrailBuilderSlots {
|
|
124
|
+
renderRecipientSearch?: (ctx: GuardrailRecipientSearchContext) => React.ReactNode;
|
|
125
|
+
renderStaticRecipient?: (ctx: GuardrailStaticRecipientContext) => React.ReactNode | undefined;
|
|
126
|
+
renderAppPicker?: (ctx: GuardrailAppPickerContext) => React.ReactNode;
|
|
127
|
+
escalateHelp?: React.ReactNode;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=builder-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder-types.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/builder-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAQzF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAGlE,eAAO,MAAM,sBAAsB;;;;;;;CAOzB,CAAC;AACX,MAAM,MAAM,2BAA2B,GACrC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC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=>{
|
|
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
|
+
getGuardrailSelectorErrorFields: ()=>getGuardrailSelectorErrorFields,
|
|
28
|
+
generateGuardrailId: ()=>generateGuardrailId,
|
|
29
|
+
initGuardrailBuilderFormData: ()=>initGuardrailBuilderFormData,
|
|
30
|
+
createDefaultGuardrailAction: ()=>createDefaultGuardrailAction,
|
|
31
|
+
getGuardrailActionErrorFields: ()=>getGuardrailActionErrorFields
|
|
32
|
+
});
|
|
33
|
+
const external_builder_types_cjs_namespaceObject = require("./builder-types.cjs");
|
|
34
|
+
const external_utils_cjs_namespaceObject = require("./utils.cjs");
|
|
35
|
+
function generateGuardrailId() {
|
|
36
|
+
return `guardrail-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 7)}`;
|
|
37
|
+
}
|
|
38
|
+
function createDefaultGuardrailAction(type) {
|
|
39
|
+
switch(type){
|
|
40
|
+
case 'block':
|
|
41
|
+
return {
|
|
42
|
+
$actionType: 'block',
|
|
43
|
+
reason: ''
|
|
44
|
+
};
|
|
45
|
+
case 'filter':
|
|
46
|
+
return {
|
|
47
|
+
$actionType: 'filter',
|
|
48
|
+
fields: []
|
|
49
|
+
};
|
|
50
|
+
case 'escalate':
|
|
51
|
+
return {
|
|
52
|
+
$actionType: 'escalate',
|
|
53
|
+
app: {
|
|
54
|
+
id: '',
|
|
55
|
+
version: '',
|
|
56
|
+
name: ''
|
|
57
|
+
},
|
|
58
|
+
recipient: {
|
|
59
|
+
type: external_builder_types_cjs_namespaceObject.GuardrailRecipientType.User,
|
|
60
|
+
value: '',
|
|
61
|
+
displayName: ''
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
default:
|
|
65
|
+
return {
|
|
66
|
+
$actionType: 'log',
|
|
67
|
+
severityLevel: 'Info'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function getGuardrailActionErrorFields(action) {
|
|
72
|
+
const fields = [];
|
|
73
|
+
switch(action.$actionType){
|
|
74
|
+
case 'block':
|
|
75
|
+
if (!action.reason.trim()) fields.push('blockReason');
|
|
76
|
+
break;
|
|
77
|
+
case 'filter':
|
|
78
|
+
if (0 === action.fields.length) fields.push('filterFields');
|
|
79
|
+
break;
|
|
80
|
+
case 'escalate':
|
|
81
|
+
{
|
|
82
|
+
const recipient = action.recipient;
|
|
83
|
+
const filled = 'value' in recipient ? recipient.value.trim().length > 0 : recipient.assetName.trim().length > 0;
|
|
84
|
+
if (!filled) fields.push('recipient');
|
|
85
|
+
if (!action.app.id) fields.push('actionApp');
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return fields;
|
|
90
|
+
}
|
|
91
|
+
function getGuardrailSelectorErrorFields(selector) {
|
|
92
|
+
const fields = [];
|
|
93
|
+
if (0 === selector.scopes.length) fields.push('scopes');
|
|
94
|
+
if (selector.scopes.includes('Tool') && (!selector.matchNames || 0 === selector.matchNames.length)) fields.push('toolNames');
|
|
95
|
+
return fields;
|
|
96
|
+
}
|
|
97
|
+
function initGuardrailBuilderFormData(definition, scope, existing, toolName) {
|
|
98
|
+
if (existing) return {
|
|
99
|
+
id: existing.id,
|
|
100
|
+
name: existing.name,
|
|
101
|
+
description: existing.description ?? '',
|
|
102
|
+
selector: existing.selector,
|
|
103
|
+
action: existing.action,
|
|
104
|
+
enabledForEvals: existing.enabledForEvals,
|
|
105
|
+
validatorParameters: (0, external_utils_cjs_namespaceObject.normalizeGuardrailParameters)(existing.validatorParameters, definition.parameters)
|
|
106
|
+
};
|
|
107
|
+
const initialScope = definition.allowedScopes.includes(scope) ? scope : definition.allowedScopes[0] ?? scope;
|
|
108
|
+
return {
|
|
109
|
+
id: generateGuardrailId(),
|
|
110
|
+
name: definition.displayName,
|
|
111
|
+
description: '',
|
|
112
|
+
selector: {
|
|
113
|
+
scopes: [
|
|
114
|
+
initialScope
|
|
115
|
+
],
|
|
116
|
+
...'Tool' === initialScope && toolName ? {
|
|
117
|
+
matchNames: [
|
|
118
|
+
toolName
|
|
119
|
+
]
|
|
120
|
+
} : {}
|
|
121
|
+
},
|
|
122
|
+
action: {
|
|
123
|
+
$actionType: 'log',
|
|
124
|
+
severityLevel: 'Info'
|
|
125
|
+
},
|
|
126
|
+
enabledForEvals: true,
|
|
127
|
+
validatorParameters: (0, external_utils_cjs_namespaceObject.seedGuardrailParameters)(definition.parameters)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
exports.createDefaultGuardrailAction = __webpack_exports__.createDefaultGuardrailAction;
|
|
131
|
+
exports.generateGuardrailId = __webpack_exports__.generateGuardrailId;
|
|
132
|
+
exports.getGuardrailActionErrorFields = __webpack_exports__.getGuardrailActionErrorFields;
|
|
133
|
+
exports.getGuardrailSelectorErrorFields = __webpack_exports__.getGuardrailSelectorErrorFields;
|
|
134
|
+
exports.initGuardrailBuilderFormData = __webpack_exports__.initGuardrailBuilderFormData;
|
|
135
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
136
|
+
"createDefaultGuardrailAction",
|
|
137
|
+
"generateGuardrailId",
|
|
138
|
+
"getGuardrailActionErrorFields",
|
|
139
|
+
"getGuardrailSelectorErrorFields",
|
|
140
|
+
"initGuardrailBuilderFormData"
|
|
141
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
142
|
+
Object.defineProperty(exports, '__esModule', {
|
|
143
|
+
value: true
|
|
144
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type GuardrailAction, type GuardrailBuilderValue, type GuardrailDefinition, type GuardrailScope, type GuardrailSelector } from './builder-types';
|
|
2
|
+
export declare function generateGuardrailId(): string;
|
|
3
|
+
export declare function createDefaultGuardrailAction(type: GuardrailAction['$actionType']): GuardrailAction;
|
|
4
|
+
export type GuardrailActionErrorField = 'blockReason' | 'filterFields' | 'recipient' | 'actionApp';
|
|
5
|
+
export declare function getGuardrailActionErrorFields(action: GuardrailAction): GuardrailActionErrorField[];
|
|
6
|
+
export type GuardrailSelectorErrorField = 'scopes' | 'toolNames';
|
|
7
|
+
export declare function getGuardrailSelectorErrorFields(selector: GuardrailSelector): GuardrailSelectorErrorField[];
|
|
8
|
+
export interface GuardrailBuilderFormData {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
selector: GuardrailSelector;
|
|
13
|
+
action: GuardrailAction;
|
|
14
|
+
enabledForEvals: boolean;
|
|
15
|
+
validatorParameters: GuardrailBuilderValue['validatorParameters'];
|
|
16
|
+
}
|
|
17
|
+
export declare function initGuardrailBuilderFormData(definition: GuardrailDefinition, scope: GuardrailScope, existing?: GuardrailBuilderValue, toolName?: string): GuardrailBuilderFormData;
|
|
18
|
+
//# sourceMappingURL=builder-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder-utils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/builder-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AAGzB,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAGD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,eAAe,CAAC,aAAa,CAAC,GACnC,eAAe,CAejB;AAED,MAAM,MAAM,yBAAyB,GAAG,aAAa,GAAG,cAAc,GAAG,WAAW,GAAG,WAAW,CAAC;AAGnG,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,eAAe,GACtB,yBAAyB,EAAE,CAqB7B;AAED,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GAAG,WAAW,CAAC;AAMjE,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,iBAAiB,GAC1B,2BAA2B,EAAE,CAU/B;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,eAAe,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,qBAAqB,CAAC,qBAAqB,CAAC,CAAC;CACnE;AAUD,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,mBAAmB,EAC/B,KAAK,EAAE,cAAc,EACrB,QAAQ,CAAC,EAAE,qBAAqB,EAChC,QAAQ,CAAC,EAAE,MAAM,GAChB,wBAAwB,CAwC1B"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { GuardrailRecipientType } from "./builder-types.js";
|
|
2
|
+
import { normalizeGuardrailParameters, seedGuardrailParameters } from "./utils.js";
|
|
3
|
+
function generateGuardrailId() {
|
|
4
|
+
return `guardrail-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 7)}`;
|
|
5
|
+
}
|
|
6
|
+
function createDefaultGuardrailAction(type) {
|
|
7
|
+
switch(type){
|
|
8
|
+
case 'block':
|
|
9
|
+
return {
|
|
10
|
+
$actionType: 'block',
|
|
11
|
+
reason: ''
|
|
12
|
+
};
|
|
13
|
+
case 'filter':
|
|
14
|
+
return {
|
|
15
|
+
$actionType: 'filter',
|
|
16
|
+
fields: []
|
|
17
|
+
};
|
|
18
|
+
case 'escalate':
|
|
19
|
+
return {
|
|
20
|
+
$actionType: 'escalate',
|
|
21
|
+
app: {
|
|
22
|
+
id: '',
|
|
23
|
+
version: '',
|
|
24
|
+
name: ''
|
|
25
|
+
},
|
|
26
|
+
recipient: {
|
|
27
|
+
type: GuardrailRecipientType.User,
|
|
28
|
+
value: '',
|
|
29
|
+
displayName: ''
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
default:
|
|
33
|
+
return {
|
|
34
|
+
$actionType: 'log',
|
|
35
|
+
severityLevel: 'Info'
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function getGuardrailActionErrorFields(action) {
|
|
40
|
+
const fields = [];
|
|
41
|
+
switch(action.$actionType){
|
|
42
|
+
case 'block':
|
|
43
|
+
if (!action.reason.trim()) fields.push('blockReason');
|
|
44
|
+
break;
|
|
45
|
+
case 'filter':
|
|
46
|
+
if (0 === action.fields.length) fields.push('filterFields');
|
|
47
|
+
break;
|
|
48
|
+
case 'escalate':
|
|
49
|
+
{
|
|
50
|
+
const recipient = action.recipient;
|
|
51
|
+
const filled = 'value' in recipient ? recipient.value.trim().length > 0 : recipient.assetName.trim().length > 0;
|
|
52
|
+
if (!filled) fields.push('recipient');
|
|
53
|
+
if (!action.app.id) fields.push('actionApp');
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return fields;
|
|
58
|
+
}
|
|
59
|
+
function getGuardrailSelectorErrorFields(selector) {
|
|
60
|
+
const fields = [];
|
|
61
|
+
if (0 === selector.scopes.length) fields.push('scopes');
|
|
62
|
+
if (selector.scopes.includes('Tool') && (!selector.matchNames || 0 === selector.matchNames.length)) fields.push('toolNames');
|
|
63
|
+
return fields;
|
|
64
|
+
}
|
|
65
|
+
function initGuardrailBuilderFormData(definition, scope, existing, toolName) {
|
|
66
|
+
if (existing) return {
|
|
67
|
+
id: existing.id,
|
|
68
|
+
name: existing.name,
|
|
69
|
+
description: existing.description ?? '',
|
|
70
|
+
selector: existing.selector,
|
|
71
|
+
action: existing.action,
|
|
72
|
+
enabledForEvals: existing.enabledForEvals,
|
|
73
|
+
validatorParameters: normalizeGuardrailParameters(existing.validatorParameters, definition.parameters)
|
|
74
|
+
};
|
|
75
|
+
const initialScope = definition.allowedScopes.includes(scope) ? scope : definition.allowedScopes[0] ?? scope;
|
|
76
|
+
return {
|
|
77
|
+
id: generateGuardrailId(),
|
|
78
|
+
name: definition.displayName,
|
|
79
|
+
description: '',
|
|
80
|
+
selector: {
|
|
81
|
+
scopes: [
|
|
82
|
+
initialScope
|
|
83
|
+
],
|
|
84
|
+
...'Tool' === initialScope && toolName ? {
|
|
85
|
+
matchNames: [
|
|
86
|
+
toolName
|
|
87
|
+
]
|
|
88
|
+
} : {}
|
|
89
|
+
},
|
|
90
|
+
action: {
|
|
91
|
+
$actionType: 'log',
|
|
92
|
+
severityLevel: 'Info'
|
|
93
|
+
},
|
|
94
|
+
enabledForEvals: true,
|
|
95
|
+
validatorParameters: seedGuardrailParameters(definition.parameters)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export { createDefaultGuardrailAction, generateGuardrailId, getGuardrailActionErrorFields, getGuardrailSelectorErrorFields, initGuardrailBuilderFormData };
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
EnumListChipsField: ()=>EnumListChipsField
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
const external_field_shell_cjs_namespaceObject = require("./field-shell.cjs");
|
|
33
|
+
const external_guardrail_chip_cjs_namespaceObject = require("./guardrail-chip.cjs");
|
|
34
|
+
const external_parameter_label_cjs_namespaceObject = require("./parameter-label.cjs");
|
|
35
|
+
function EnumListChipsField(props) {
|
|
36
|
+
const { value, onChange, error, disabled } = props;
|
|
37
|
+
const paramDef = props.paramDef;
|
|
38
|
+
const labels = props.labels;
|
|
39
|
+
const uid = (0, external_react_namespaceObject.useId)();
|
|
40
|
+
const selected = Array.isArray(value) ? value : [];
|
|
41
|
+
const labelFor = (option)=>paramDef.optionLabels?.[option] ?? option;
|
|
42
|
+
const handleToggle = (option, pressed)=>{
|
|
43
|
+
onChange(pressed ? [
|
|
44
|
+
...selected,
|
|
45
|
+
option
|
|
46
|
+
] : selected.filter((s)=>s !== option));
|
|
47
|
+
};
|
|
48
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
|
|
49
|
+
"data-slot": "guardrail-enum-list-field",
|
|
50
|
+
children: [
|
|
51
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_parameter_label_cjs_namespaceObject.ParameterLabel, {
|
|
52
|
+
id: `${uid}-label`,
|
|
53
|
+
paramDef: paramDef,
|
|
54
|
+
labels: labels
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_field_shell_cjs_namespaceObject.FieldShell, {
|
|
57
|
+
invalid: Boolean(error),
|
|
58
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
59
|
+
role: "group",
|
|
60
|
+
"aria-labelledby": `${uid}-label`,
|
|
61
|
+
"aria-invalid": error ? true : void 0,
|
|
62
|
+
"aria-describedby": error ? `${uid}-error` : void 0,
|
|
63
|
+
className: "flex flex-wrap gap-1.5",
|
|
64
|
+
children: (paramDef.options ?? []).map((option)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_guardrail_chip_cjs_namespaceObject.GuardrailChip, {
|
|
65
|
+
pressed: selected.includes(option),
|
|
66
|
+
onPressedChange: (pressed)=>handleToggle(option, pressed),
|
|
67
|
+
disabled: disabled,
|
|
68
|
+
children: labelFor(option)
|
|
69
|
+
}, option))
|
|
70
|
+
})
|
|
71
|
+
}),
|
|
72
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.FormFieldError, {
|
|
73
|
+
id: `${uid}-error`,
|
|
74
|
+
children: error
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
exports.EnumListChipsField = __webpack_exports__.EnumListChipsField;
|
|
80
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
81
|
+
"EnumListChipsField"
|
|
82
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
83
|
+
Object.defineProperty(exports, '__esModule', {
|
|
84
|
+
value: true
|
|
85
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum-list-chips-field.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/enum-list-chips-field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAerE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,yBAAyB,2CAmDlE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FormField, FormFieldError } from "@uipath/apollo-wind";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { FieldShell } from "./field-shell.js";
|
|
5
|
+
import { GuardrailChip } from "./guardrail-chip.js";
|
|
6
|
+
import { ParameterLabel } from "./parameter-label.js";
|
|
7
|
+
function EnumListChipsField(props) {
|
|
8
|
+
const { value, onChange, error, disabled } = props;
|
|
9
|
+
const paramDef = props.paramDef;
|
|
10
|
+
const labels = props.labels;
|
|
11
|
+
const uid = useId();
|
|
12
|
+
const selected = Array.isArray(value) ? value : [];
|
|
13
|
+
const labelFor = (option)=>paramDef.optionLabels?.[option] ?? option;
|
|
14
|
+
const handleToggle = (option, pressed)=>{
|
|
15
|
+
onChange(pressed ? [
|
|
16
|
+
...selected,
|
|
17
|
+
option
|
|
18
|
+
] : selected.filter((s)=>s !== option));
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/ jsxs(FormField, {
|
|
21
|
+
"data-slot": "guardrail-enum-list-field",
|
|
22
|
+
children: [
|
|
23
|
+
/*#__PURE__*/ jsx(ParameterLabel, {
|
|
24
|
+
id: `${uid}-label`,
|
|
25
|
+
paramDef: paramDef,
|
|
26
|
+
labels: labels
|
|
27
|
+
}),
|
|
28
|
+
/*#__PURE__*/ jsx(FieldShell, {
|
|
29
|
+
invalid: Boolean(error),
|
|
30
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
31
|
+
role: "group",
|
|
32
|
+
"aria-labelledby": `${uid}-label`,
|
|
33
|
+
"aria-invalid": error ? true : void 0,
|
|
34
|
+
"aria-describedby": error ? `${uid}-error` : void 0,
|
|
35
|
+
className: "flex flex-wrap gap-1.5",
|
|
36
|
+
children: (paramDef.options ?? []).map((option)=>/*#__PURE__*/ jsx(GuardrailChip, {
|
|
37
|
+
pressed: selected.includes(option),
|
|
38
|
+
onPressedChange: (pressed)=>handleToggle(option, pressed),
|
|
39
|
+
disabled: disabled,
|
|
40
|
+
children: labelFor(option)
|
|
41
|
+
}, option))
|
|
42
|
+
})
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsx(FormFieldError, {
|
|
45
|
+
id: `${uid}-error`,
|
|
46
|
+
children: error
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export { EnumListChipsField };
|