@uipath/apollo-react 7.2.2 → 7.3.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/__fixtures__/classifier-questions.fixtures.d.ts +3 -0
- package/dist/canvas/components/Guardrails/__fixtures__/classifier-questions.fixtures.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.d.ts +2 -0
- package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/classifier-custom-questions-editor.cjs +220 -0
- package/dist/canvas/components/Guardrails/classifier-custom-questions-editor.d.ts +13 -0
- package/dist/canvas/components/Guardrails/classifier-custom-questions-editor.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/classifier-custom-questions-editor.js +186 -0
- package/dist/canvas/components/Guardrails/classifier-question-picker.cjs +316 -0
- package/dist/canvas/components/Guardrails/classifier-question-picker.d.ts +15 -0
- package/dist/canvas/components/Guardrails/classifier-question-picker.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/classifier-question-picker.js +282 -0
- package/dist/canvas/components/Guardrails/classifier-utils.cjs +139 -0
- package/dist/canvas/components/Guardrails/classifier-utils.d.ts +25 -0
- package/dist/canvas/components/Guardrails/classifier-utils.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/classifier-utils.js +87 -0
- package/dist/canvas/components/Guardrails/components/classifier-threshold-slider.cjs +98 -0
- package/dist/canvas/components/Guardrails/components/classifier-threshold-slider.d.ts +9 -0
- package/dist/canvas/components/Guardrails/components/classifier-threshold-slider.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/classifier-threshold-slider.js +64 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.d.ts +1 -1
- package/dist/canvas/components/Guardrails/components/parameter-label.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/definitions-copy.cjs +66 -1
- package/dist/canvas/components/Guardrails/definitions-copy.d.ts +1 -0
- package/dist/canvas/components/Guardrails/definitions-copy.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/definitions-copy.js +66 -1
- package/dist/canvas/components/Guardrails/definitions-parse.cjs +66 -1
- package/dist/canvas/components/Guardrails/definitions-parse.d.ts +11 -1
- package/dist/canvas/components/Guardrails/definitions-parse.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/definitions-parse.js +63 -1
- package/dist/canvas/components/Guardrails/definitions-wire.d.ts +11 -0
- package/dist/canvas/components/Guardrails/definitions-wire.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/guardrail-builder.cjs +12 -4
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/guardrail-builder.js +12 -4
- package/dist/canvas/components/Guardrails/guardrail-validator-form.cjs +4 -1
- package/dist/canvas/components/Guardrails/guardrail-validator-form.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/guardrail-validator-form.js +4 -1
- package/dist/canvas/components/Guardrails/i18n.cjs +181 -3
- package/dist/canvas/components/Guardrails/i18n.d.ts +39 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/i18n.js +168 -2
- package/dist/canvas/components/Guardrails/index.cjs +54 -4
- package/dist/canvas/components/Guardrails/index.d.ts +14 -3
- package/dist/canvas/components/Guardrails/index.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/index.js +7 -2
- package/dist/canvas/components/Guardrails/use-classifier-guardrail-parameters.cjs +136 -0
- package/dist/canvas/components/Guardrails/use-classifier-guardrail-parameters.d.ts +18 -0
- package/dist/canvas/components/Guardrails/use-classifier-guardrail-parameters.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-classifier-guardrail-parameters.js +102 -0
- package/dist/canvas/components/Guardrails/use-classifier-questions.cjs +97 -0
- package/dist/canvas/components/Guardrails/use-classifier-questions.d.ts +34 -0
- package/dist/canvas/components/Guardrails/use-classifier-questions.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-classifier-questions.js +60 -0
- package/dist/canvas/components/Guardrails/use-guardrail-definitions.cjs +8 -81
- package/dist/canvas/components/Guardrails/use-guardrail-definitions.d.ts +2 -8
- package/dist/canvas/components/Guardrails/use-guardrail-definitions.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/use-guardrail-definitions.js +9 -82
- package/dist/canvas/components/Guardrails/use-guardrails-request.cjs +133 -0
- package/dist/canvas/components/Guardrails/use-guardrails-request.d.ts +23 -0
- package/dist/canvas/components/Guardrails/use-guardrails-request.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-guardrails-request.js +99 -0
- package/dist/canvas/components/Guardrails/utils.cjs +4 -2
- package/dist/canvas/components/Guardrails/utils.d.ts +4 -1
- package/dist/canvas/components/Guardrails/utils.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/utils.js +4 -2
- 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/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,9 @@ import { createDefaultGuardrailAction, generateGuardrailId, getGuardrailActionEr
|
|
|
3
3
|
import { CentralizedGuardrailDetails } from "./centralized-guardrail-details.js";
|
|
4
4
|
import { findCentralizedBuiltInDefinition, findCentralizedByoDefinition, formatCentralizedAction, formatCentralizedExecutionStage, formatCentralizedScope, getApplicableCentralizedGuardrails, getCentralizedGuardrailDisplay, getCentralizedGuardrailItemId, isCentralizedGuardrailConfigMissing, resolveCentralizedGuardrailParameters } from "./centralized-guardrail-utils.js";
|
|
5
5
|
import { CentralizedGuardrailsSection } from "./centralized-guardrails-section.js";
|
|
6
|
+
import { ClassifierCustomQuestionsEditor } from "./classifier-custom-questions-editor.js";
|
|
7
|
+
import { ClassifierQuestionPicker } from "./classifier-question-picker.js";
|
|
8
|
+
import { CLASSIFIER_DEFAULT_THRESHOLD, CLASSIFIER_PARAMETER_IDS, CLASSIFIER_VALIDATOR, hasClassifierQuestions, readClassifierCustomQuestions, writeClassifierCustomQuestions } from "./classifier-utils.js";
|
|
6
9
|
import { EscalateActionFields } from "./components/escalate-action-fields.js";
|
|
7
10
|
import { GuardrailActionSection } from "./components/guardrail-action-section.js";
|
|
8
11
|
import { GuardrailChip, guardrailChipVariants } from "./components/guardrail-chip.js";
|
|
@@ -26,9 +29,11 @@ import { getGuardrailPaletteItemId, groupGuardrailsForPalette } from "./guardrai
|
|
|
26
29
|
import { GuardrailRemoveDialog } from "./guardrail-remove-dialog.js";
|
|
27
30
|
import { GuardrailRulesSection } from "./guardrail-rules-section.js";
|
|
28
31
|
import { GuardrailValidatorForm } from "./guardrail-validator-form.js";
|
|
29
|
-
import { CENTRALIZED_GUARDRAILS_EN_LABELS, CENTRALIZED_GUARDRAILS_EN_MESSAGES, CUSTOM_GUARDRAIL_BUILDER_EN_LABELS, CUSTOM_GUARDRAIL_BUILDER_EN_MESSAGES, CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS, GUARDRAIL_ACTION_EN_LABELS, GUARDRAIL_ACTION_LABEL_KEYS, GUARDRAIL_BUILDER_EN_LABELS, GUARDRAIL_FILE_SUPPORT_EN_LABELS, GUARDRAIL_FILTER_FIELD_SELECTOR_EN_LABELS, GUARDRAIL_FILTER_FIELD_SELECTOR_LABEL_KEYS, GUARDRAIL_FORM_EN_LABELS, GUARDRAIL_LIST_EN_LABELS, GUARDRAIL_LIST_EN_MESSAGES, GUARDRAIL_PALETTE_EN_LABELS, GUARDRAIL_PALETTE_EN_MESSAGES, GUARDRAIL_REMOVE_DIALOG_EN_LABELS, GUARDRAIL_REMOVE_DIALOG_EN_MESSAGES, GUARDRAIL_RULES_EN_LABELS, GUARDRAIL_RULES_EN_MESSAGES, GUARDRAIL_SCOPE_SELECTOR_EN_LABELS, GUARDRAIL_SCOPE_SELECTOR_LABEL_KEYS, formatGuardrailFormMessage, resolveCentralizedGuardrailsLabels, resolveCustomGuardrailBuilderLabels, resolveGuardrailActionLabels, resolveGuardrailBuilderLabels, resolveGuardrailFileSupportLabels, resolveGuardrailFilterFieldSelectorLabels, resolveGuardrailFormLabels, resolveGuardrailListLabels, resolveGuardrailPaletteLabels, resolveGuardrailRemoveDialogLabels, resolveGuardrailRulesLabels, resolveGuardrailScopeSelectorLabels, useCentralizedGuardrailsLabels, useCustomGuardrailBuilderLabels, useGuardrailActionLabels, useGuardrailBuilderLabels, useGuardrailFileSupportLabels, useGuardrailFilterFieldSelectorLabels, useGuardrailFormLabels, useGuardrailListLabels, useGuardrailPaletteLabels, useGuardrailRemoveDialogLabels, useGuardrailRulesLabels, useGuardrailScopeSelectorLabels } from "./i18n.js";
|
|
32
|
+
import { CENTRALIZED_GUARDRAILS_EN_LABELS, CENTRALIZED_GUARDRAILS_EN_MESSAGES, CUSTOM_GUARDRAIL_BUILDER_EN_LABELS, CUSTOM_GUARDRAIL_BUILDER_EN_MESSAGES, CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS, GUARDRAIL_ACTION_EN_LABELS, GUARDRAIL_ACTION_LABEL_KEYS, GUARDRAIL_BUILDER_EN_LABELS, GUARDRAIL_CLASSIFIER_EN_LABELS, GUARDRAIL_CLASSIFIER_EN_MESSAGES, GUARDRAIL_FILE_SUPPORT_EN_LABELS, GUARDRAIL_FILTER_FIELD_SELECTOR_EN_LABELS, GUARDRAIL_FILTER_FIELD_SELECTOR_LABEL_KEYS, GUARDRAIL_FORM_EN_LABELS, GUARDRAIL_LIST_EN_LABELS, GUARDRAIL_LIST_EN_MESSAGES, GUARDRAIL_PALETTE_EN_LABELS, GUARDRAIL_PALETTE_EN_MESSAGES, GUARDRAIL_REMOVE_DIALOG_EN_LABELS, GUARDRAIL_REMOVE_DIALOG_EN_MESSAGES, GUARDRAIL_RULES_EN_LABELS, GUARDRAIL_RULES_EN_MESSAGES, GUARDRAIL_SCOPE_SELECTOR_EN_LABELS, GUARDRAIL_SCOPE_SELECTOR_LABEL_KEYS, formatGuardrailFormMessage, resolveCentralizedGuardrailsLabels, resolveCustomGuardrailBuilderLabels, resolveGuardrailActionLabels, resolveGuardrailBuilderLabels, resolveGuardrailClassifierLabels, resolveGuardrailFileSupportLabels, resolveGuardrailFilterFieldSelectorLabels, resolveGuardrailFormLabels, resolveGuardrailListLabels, resolveGuardrailPaletteLabels, resolveGuardrailRemoveDialogLabels, resolveGuardrailRulesLabels, resolveGuardrailScopeSelectorLabels, useCentralizedGuardrailsLabels, useCustomGuardrailBuilderLabels, useGuardrailActionLabels, useGuardrailBuilderLabels, useGuardrailClassifierLabels, useGuardrailFileSupportLabels, useGuardrailFilterFieldSelectorLabels, useGuardrailFormLabels, useGuardrailListLabels, useGuardrailPaletteLabels, useGuardrailRemoveDialogLabels, useGuardrailRulesLabels, useGuardrailScopeSelectorLabels } from "./i18n.js";
|
|
30
33
|
import { GUARDRAIL_RULE_OPERATORS } from "./rules-types.js";
|
|
31
34
|
import { changeGuardrailRuleType, createGuardrailRule, getGuardrailRuleErrorFields, getGuardrailRulesErrorFields, guardrailOperatorTakesValue } from "./rules-utils.js";
|
|
35
|
+
import { useClassifierGuardrailParameters } from "./use-classifier-guardrail-parameters.js";
|
|
36
|
+
import { CLASSIFIER_QUESTIONS_PATH, useClassifierQuestions } from "./use-classifier-questions.js";
|
|
32
37
|
import { GUARDRAIL_DEFINITIONS_PATH, useGuardrailDefinitions } from "./use-guardrail-definitions.js";
|
|
33
38
|
import { GUARDRAIL_DETECTION_SCOPE_PARAMETER_ID, dropEmptyOptionalParameters, getGuardrailDetectionScope, getOutOfRangeParameterIds, getRequiredEmptyParameterIds, seedGuardrailParameters, syncMapEnumParameters } from "./utils.js";
|
|
34
|
-
export { CENTRALIZED_GUARDRAILS_EN_LABELS, CENTRALIZED_GUARDRAILS_EN_MESSAGES, CURATED_GUARDRAIL_VALIDATORS, CUSTOM_GUARDRAIL_BUILDER_EN_LABELS, CUSTOM_GUARDRAIL_BUILDER_EN_MESSAGES, CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS, CentralizedGuardrailDetails, CentralizedGuardrailsSection, CustomGuardrailBuilder, EscalateActionFields, GUARDRAIL_ACTION_EN_LABELS, GUARDRAIL_ACTION_LABEL_KEYS, GUARDRAIL_BUILDER_EN_LABELS, GUARDRAIL_BYO_VALIDATOR_TYPE, GUARDRAIL_COPY_EN, GUARDRAIL_COPY_EN_MESSAGES, GUARDRAIL_DEFINITIONS_PATH, GUARDRAIL_DETECTION_SCOPE_PARAMETER_ID, GUARDRAIL_FILE_SUPPORT_EN_LABELS, GUARDRAIL_FILTER_FIELD_SELECTOR_EN_LABELS, GUARDRAIL_FILTER_FIELD_SELECTOR_LABEL_KEYS, GUARDRAIL_FORM_EN_LABELS, GUARDRAIL_LIST_EN_LABELS, GUARDRAIL_LIST_EN_MESSAGES, GUARDRAIL_PALETTE_EN_LABELS, GUARDRAIL_PALETTE_EN_MESSAGES, GUARDRAIL_REMOVE_DIALOG_EN_LABELS, GUARDRAIL_REMOVE_DIALOG_EN_MESSAGES, GUARDRAIL_RULES_EN_LABELS, GUARDRAIL_RULES_EN_MESSAGES, GUARDRAIL_RULE_OPERATORS, GUARDRAIL_SCOPE_SELECTOR_EN_LABELS, GUARDRAIL_SCOPE_SELECTOR_LABEL_KEYS, GuardrailActionSection, GuardrailBuilder, GuardrailChip, GuardrailFileSupportIndicator, GuardrailFilterFieldSelector, GuardrailFormLayout, GuardrailList, GuardrailPalette, GuardrailRecipientType, GuardrailRemoveDialog, GuardrailRulesSection, GuardrailScopeSelector, GuardrailStatusBanner, GuardrailStatusChip, GuardrailValidatorForm, MixedScopesBanner, changeGuardrailRuleType, createDefaultCustomGuardrail, createDefaultGuardrailAction, createGuardrailRule, dropEmptyOptionalParameters, enrichGuardrailDefinitions, findCentralizedBuiltInDefinition, findCentralizedByoDefinition, formatCentralizedAction, formatCentralizedExecutionStage, formatCentralizedScope, formatGuardrailFormMessage, generateGuardrailId, getApplicableCentralizedGuardrails, getCentralizedGuardrailDisplay, getCentralizedGuardrailItemId, getCustomGuardrailErrorFields, getGuardrailActionErrorFields, getGuardrailDetectionScope, getGuardrailListChips, getGuardrailListItemId, getGuardrailPaletteItemId, getGuardrailRuleErrorFields, getGuardrailRulesErrorFields, getGuardrailSelectorErrorFields, getOutOfRangeParameterIds, getRequiredEmptyParameterIds, groupGuardrailsForPalette, guardrailChipVariants, guardrailOperatorTakesValue, humanizeGuardrailParameterId, initCustomGuardrailBuilderFormData, initGuardrailBuilderFormData, isByoGuardrailDefinition, isCentralizedGuardrailConfigMissing, matchesGuardrailListDefinition, parseGuardrailDefinitions, resolveCentralizedGuardrailParameters, resolveCentralizedGuardrailsLabels, resolveCustomGuardrailBuilderLabels, resolveGuardrailActionLabels, resolveGuardrailBuilderLabels, resolveGuardrailFileSupportLabels, resolveGuardrailFilterFieldSelectorLabels, resolveGuardrailFormLabels, resolveGuardrailListItemState, resolveGuardrailListLabels, resolveGuardrailPaletteLabels, resolveGuardrailRemoveDialogLabels, resolveGuardrailRulesLabels, resolveGuardrailScopeSelectorLabels, seedGuardrailParameters, syncMapEnumParameters, useCentralizedGuardrailsLabels, useCustomGuardrailBuilderLabels, useGuardrailActionLabels, useGuardrailBuilderLabels, useGuardrailDefinitionCopy, useGuardrailDefinitions, useGuardrailFileSupportLabels, useGuardrailFilterFieldSelectorLabels, useGuardrailFormLabels, useGuardrailListLabels, useGuardrailPaletteLabels, useGuardrailRemoveDialogLabels, useGuardrailRulesLabels, useGuardrailScopeSelectorLabels, withGuardrailFolderMetadata };
|
|
39
|
+
export { CENTRALIZED_GUARDRAILS_EN_LABELS, CENTRALIZED_GUARDRAILS_EN_MESSAGES, CLASSIFIER_DEFAULT_THRESHOLD, CLASSIFIER_PARAMETER_IDS, CLASSIFIER_QUESTIONS_PATH, CLASSIFIER_VALIDATOR, CURATED_GUARDRAIL_VALIDATORS, CUSTOM_GUARDRAIL_BUILDER_EN_LABELS, CUSTOM_GUARDRAIL_BUILDER_EN_MESSAGES, CUSTOM_GUARDRAIL_BUILDER_REUSED_LABEL_KEYS, CentralizedGuardrailDetails, CentralizedGuardrailsSection, ClassifierCustomQuestionsEditor, ClassifierQuestionPicker, CustomGuardrailBuilder, EscalateActionFields, GUARDRAIL_ACTION_EN_LABELS, GUARDRAIL_ACTION_LABEL_KEYS, GUARDRAIL_BUILDER_EN_LABELS, GUARDRAIL_BYO_VALIDATOR_TYPE, GUARDRAIL_CLASSIFIER_EN_LABELS, GUARDRAIL_CLASSIFIER_EN_MESSAGES, GUARDRAIL_COPY_EN, GUARDRAIL_COPY_EN_MESSAGES, GUARDRAIL_DEFINITIONS_PATH, GUARDRAIL_DETECTION_SCOPE_PARAMETER_ID, GUARDRAIL_FILE_SUPPORT_EN_LABELS, GUARDRAIL_FILTER_FIELD_SELECTOR_EN_LABELS, GUARDRAIL_FILTER_FIELD_SELECTOR_LABEL_KEYS, GUARDRAIL_FORM_EN_LABELS, GUARDRAIL_LIST_EN_LABELS, GUARDRAIL_LIST_EN_MESSAGES, GUARDRAIL_PALETTE_EN_LABELS, GUARDRAIL_PALETTE_EN_MESSAGES, GUARDRAIL_REMOVE_DIALOG_EN_LABELS, GUARDRAIL_REMOVE_DIALOG_EN_MESSAGES, GUARDRAIL_RULES_EN_LABELS, GUARDRAIL_RULES_EN_MESSAGES, GUARDRAIL_RULE_OPERATORS, GUARDRAIL_SCOPE_SELECTOR_EN_LABELS, GUARDRAIL_SCOPE_SELECTOR_LABEL_KEYS, GuardrailActionSection, GuardrailBuilder, GuardrailChip, GuardrailFileSupportIndicator, GuardrailFilterFieldSelector, GuardrailFormLayout, GuardrailList, GuardrailPalette, GuardrailRecipientType, GuardrailRemoveDialog, GuardrailRulesSection, GuardrailScopeSelector, GuardrailStatusBanner, GuardrailStatusChip, GuardrailValidatorForm, MixedScopesBanner, changeGuardrailRuleType, createDefaultCustomGuardrail, createDefaultGuardrailAction, createGuardrailRule, dropEmptyOptionalParameters, enrichGuardrailDefinitions, findCentralizedBuiltInDefinition, findCentralizedByoDefinition, formatCentralizedAction, formatCentralizedExecutionStage, formatCentralizedScope, formatGuardrailFormMessage, generateGuardrailId, getApplicableCentralizedGuardrails, getCentralizedGuardrailDisplay, getCentralizedGuardrailItemId, getCustomGuardrailErrorFields, getGuardrailActionErrorFields, getGuardrailDetectionScope, getGuardrailListChips, getGuardrailListItemId, getGuardrailPaletteItemId, getGuardrailRuleErrorFields, getGuardrailRulesErrorFields, getGuardrailSelectorErrorFields, getOutOfRangeParameterIds, getRequiredEmptyParameterIds, groupGuardrailsForPalette, guardrailChipVariants, guardrailOperatorTakesValue, hasClassifierQuestions, humanizeGuardrailParameterId, initCustomGuardrailBuilderFormData, initGuardrailBuilderFormData, isByoGuardrailDefinition, isCentralizedGuardrailConfigMissing, matchesGuardrailListDefinition, parseGuardrailDefinitions, readClassifierCustomQuestions, resolveCentralizedGuardrailParameters, resolveCentralizedGuardrailsLabels, resolveCustomGuardrailBuilderLabels, resolveGuardrailActionLabels, resolveGuardrailBuilderLabels, resolveGuardrailClassifierLabels, resolveGuardrailFileSupportLabels, resolveGuardrailFilterFieldSelectorLabels, resolveGuardrailFormLabels, resolveGuardrailListItemState, resolveGuardrailListLabels, resolveGuardrailPaletteLabels, resolveGuardrailRemoveDialogLabels, resolveGuardrailRulesLabels, resolveGuardrailScopeSelectorLabels, seedGuardrailParameters, syncMapEnumParameters, useCentralizedGuardrailsLabels, useClassifierGuardrailParameters, useClassifierQuestions, useCustomGuardrailBuilderLabels, useGuardrailActionLabels, useGuardrailBuilderLabels, useGuardrailClassifierLabels, useGuardrailDefinitionCopy, useGuardrailDefinitions, useGuardrailFileSupportLabels, useGuardrailFilterFieldSelectorLabels, useGuardrailFormLabels, useGuardrailListLabels, useGuardrailPaletteLabels, useGuardrailRemoveDialogLabels, useGuardrailRulesLabels, useGuardrailScopeSelectorLabels, withGuardrailFolderMetadata, writeClassifierCustomQuestions };
|
|
@@ -0,0 +1,136 @@
|
|
|
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
|
+
useClassifierGuardrailParameters: ()=>useClassifierGuardrailParameters
|
|
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_classifier_custom_questions_editor_cjs_namespaceObject = require("./classifier-custom-questions-editor.cjs");
|
|
33
|
+
const external_classifier_question_picker_cjs_namespaceObject = require("./classifier-question-picker.cjs");
|
|
34
|
+
const external_classifier_utils_cjs_namespaceObject = require("./classifier-utils.cjs");
|
|
35
|
+
const external_i18n_cjs_namespaceObject = require("./i18n.cjs");
|
|
36
|
+
const { selectedQuestions, questionThresholds, questions, model, modelVendor } = external_classifier_utils_cjs_namespaceObject.CLASSIFIER_PARAMETER_IDS;
|
|
37
|
+
const CLAIMED_IDS = Object.freeze([
|
|
38
|
+
selectedQuestions,
|
|
39
|
+
questionThresholds,
|
|
40
|
+
questions,
|
|
41
|
+
modelVendor
|
|
42
|
+
]);
|
|
43
|
+
const NOTHING_CLAIMED = Object.freeze([]);
|
|
44
|
+
function upsert(parameters, id, next) {
|
|
45
|
+
if (void 0 === next) return parameters.filter((p)=>p.id !== id);
|
|
46
|
+
return parameters.some((p)=>p.id === id) ? parameters.map((p)=>p.id === id ? next : p) : [
|
|
47
|
+
...parameters,
|
|
48
|
+
next
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
function useClassifierGuardrailParameters({ definition, categories, labels: labelOverrides }) {
|
|
52
|
+
const labels = (0, external_i18n_cjs_namespaceObject.useGuardrailClassifierLabels)(labelOverrides);
|
|
53
|
+
const isClassifier = definition?.validator === external_classifier_utils_cjs_namespaceObject.CLASSIFIER_VALIDATOR && void 0 === definition.byoValidatorName;
|
|
54
|
+
const [missingQuestions, setMissingQuestions] = (0, external_react_namespaceObject.useState)(false);
|
|
55
|
+
const renderParameter = (0, external_react_namespaceObject.useCallback)((ctx)=>{
|
|
56
|
+
if (!isClassifier) return;
|
|
57
|
+
const { definition: parameter, parameters } = ctx;
|
|
58
|
+
const valueFor = (id)=>parameters.find((p)=>p.id === id)?.value;
|
|
59
|
+
switch(parameter.id){
|
|
60
|
+
case selectedQuestions:
|
|
61
|
+
{
|
|
62
|
+
const stored = valueFor(questionThresholds);
|
|
63
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_classifier_question_picker_cjs_namespaceObject.ClassifierQuestionPicker, {
|
|
64
|
+
parameter: parameter,
|
|
65
|
+
categories: categories,
|
|
66
|
+
selectedQuestions: Array.isArray(ctx.value) ? ctx.value : [],
|
|
67
|
+
questionThresholds: stored && 'object' == typeof stored && !Array.isArray(stored) ? stored : {},
|
|
68
|
+
error: ctx.error ?? (missingQuestions ? labels.questionsRequired : void 0),
|
|
69
|
+
labels: labelOverrides,
|
|
70
|
+
onChange: (names, thresholds)=>{
|
|
71
|
+
setMissingQuestions(false);
|
|
72
|
+
const withNames = upsert(parameters, selectedQuestions, names.length > 0 ? {
|
|
73
|
+
$parameterType: 'enum-list',
|
|
74
|
+
id: selectedQuestions,
|
|
75
|
+
value: names
|
|
76
|
+
} : void 0);
|
|
77
|
+
ctx.onParametersChange(upsert(withNames, questionThresholds, Object.keys(thresholds).length > 0 ? {
|
|
78
|
+
$parameterType: 'map-enum',
|
|
79
|
+
id: questionThresholds,
|
|
80
|
+
value: thresholds
|
|
81
|
+
} : void 0));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
case questionThresholds:
|
|
86
|
+
return ctx.error ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.FormFieldError, {
|
|
87
|
+
children: `${parameter.label}: ${ctx.error}`
|
|
88
|
+
}) : null;
|
|
89
|
+
case questions:
|
|
90
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_classifier_custom_questions_editor_cjs_namespaceObject.ClassifierCustomQuestionsEditor, {
|
|
91
|
+
parameter: parameter,
|
|
92
|
+
rows: (0, external_classifier_utils_cjs_namespaceObject.readClassifierCustomQuestions)(parameters),
|
|
93
|
+
error: ctx.error,
|
|
94
|
+
labels: labelOverrides,
|
|
95
|
+
onRowsChange: (rows)=>{
|
|
96
|
+
setMissingQuestions(false);
|
|
97
|
+
ctx.onParametersChange((0, external_classifier_utils_cjs_namespaceObject.writeClassifierCustomQuestions)(parameters, rows));
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
case modelVendor:
|
|
101
|
+
{
|
|
102
|
+
const chosen = valueFor(model);
|
|
103
|
+
return 'string' == typeof chosen && '' !== chosen.trim() && ctx.error ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.FormFieldError, {
|
|
104
|
+
children: labels.modelVendorMissing
|
|
105
|
+
}) : null;
|
|
106
|
+
}
|
|
107
|
+
default:
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}, [
|
|
111
|
+
isClassifier,
|
|
112
|
+
categories,
|
|
113
|
+
labels,
|
|
114
|
+
labelOverrides,
|
|
115
|
+
missingQuestions
|
|
116
|
+
]);
|
|
117
|
+
const validateParameters = (0, external_react_namespaceObject.useCallback)((parameters)=>{
|
|
118
|
+
const ok = !isClassifier || (0, external_classifier_utils_cjs_namespaceObject.hasClassifierQuestions)(parameters);
|
|
119
|
+
setMissingQuestions(!ok);
|
|
120
|
+
return ok;
|
|
121
|
+
}, [
|
|
122
|
+
isClassifier
|
|
123
|
+
]);
|
|
124
|
+
return {
|
|
125
|
+
overrideParameterIds: isClassifier ? CLAIMED_IDS : NOTHING_CLAIMED,
|
|
126
|
+
renderParameter,
|
|
127
|
+
validateParameters
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
exports.useClassifierGuardrailParameters = __webpack_exports__.useClassifierGuardrailParameters;
|
|
131
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
132
|
+
"useClassifierGuardrailParameters"
|
|
133
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
134
|
+
Object.defineProperty(exports, '__esModule', {
|
|
135
|
+
value: true
|
|
136
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { GuardrailDefinition } from './builder-types';
|
|
3
|
+
import { type ClassifierParameterLike } from './classifier-utils';
|
|
4
|
+
import { type GuardrailClassifierLabels } from './i18n';
|
|
5
|
+
import type { GuardrailParameterRenderContext } from './types';
|
|
6
|
+
import type { ClassifierQuestionCategory } from './use-classifier-questions';
|
|
7
|
+
export interface UseClassifierGuardrailParametersOptions {
|
|
8
|
+
definition: Pick<GuardrailDefinition, 'validator' | 'byoValidatorName'> | undefined;
|
|
9
|
+
categories: readonly ClassifierQuestionCategory[];
|
|
10
|
+
labels?: Partial<GuardrailClassifierLabels>;
|
|
11
|
+
}
|
|
12
|
+
export interface ClassifierGuardrailParameters {
|
|
13
|
+
overrideParameterIds: readonly string[];
|
|
14
|
+
renderParameter: (ctx: GuardrailParameterRenderContext) => ReactNode | undefined;
|
|
15
|
+
validateParameters: (parameters: readonly Pick<ClassifierParameterLike, 'id' | 'value'>[]) => boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function useClassifierGuardrailParameters({ definition, categories, labels: labelOverrides, }: UseClassifierGuardrailParametersOptions): ClassifierGuardrailParameters;
|
|
18
|
+
//# sourceMappingURL=use-classifier-guardrail-parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-classifier-guardrail-parameters.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/use-classifier-guardrail-parameters.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAyB,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAGL,KAAK,uBAAuB,EAI7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,yBAAyB,EAAgC,MAAM,QAAQ,CAAC;AACtF,OAAO,KAAK,EAAE,+BAA+B,EAA+B,MAAM,SAAS,CAAC;AAC5F,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,MAAM,WAAW,uCAAuC;IAEtD,UAAU,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,GAAG,kBAAkB,CAAC,GAAG,SAAS,CAAC;IACpF,UAAU,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,6BAA6B;IAE5C,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;IAExC,eAAe,EAAE,CAAC,GAAG,EAAE,+BAA+B,KAAK,SAAS,GAAG,SAAS,CAAC;IAEjF,kBAAkB,EAAE,CAClB,UAAU,EAAE,SAAS,IAAI,CAAC,uBAAuB,EAAE,IAAI,GAAG,OAAO,CAAC,EAAE,KACjE,OAAO,CAAC;CACd;AAuBD,wBAAgB,gCAAgC,CAAC,EAC/C,UAAU,EACV,UAAU,EACV,MAAM,EAAE,cAAc,GACvB,EAAE,uCAAuC,GAAG,6BAA6B,CAgGzE"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FormFieldError } from "@uipath/apollo-wind";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { ClassifierCustomQuestionsEditor } from "./classifier-custom-questions-editor.js";
|
|
5
|
+
import { ClassifierQuestionPicker } from "./classifier-question-picker.js";
|
|
6
|
+
import { CLASSIFIER_PARAMETER_IDS, CLASSIFIER_VALIDATOR, hasClassifierQuestions, readClassifierCustomQuestions, writeClassifierCustomQuestions } from "./classifier-utils.js";
|
|
7
|
+
import { useGuardrailClassifierLabels } from "./i18n.js";
|
|
8
|
+
const { selectedQuestions, questionThresholds, questions, model, modelVendor } = CLASSIFIER_PARAMETER_IDS;
|
|
9
|
+
const CLAIMED_IDS = Object.freeze([
|
|
10
|
+
selectedQuestions,
|
|
11
|
+
questionThresholds,
|
|
12
|
+
questions,
|
|
13
|
+
modelVendor
|
|
14
|
+
]);
|
|
15
|
+
const NOTHING_CLAIMED = Object.freeze([]);
|
|
16
|
+
function upsert(parameters, id, next) {
|
|
17
|
+
if (void 0 === next) return parameters.filter((p)=>p.id !== id);
|
|
18
|
+
return parameters.some((p)=>p.id === id) ? parameters.map((p)=>p.id === id ? next : p) : [
|
|
19
|
+
...parameters,
|
|
20
|
+
next
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
function useClassifierGuardrailParameters({ definition, categories, labels: labelOverrides }) {
|
|
24
|
+
const labels = useGuardrailClassifierLabels(labelOverrides);
|
|
25
|
+
const isClassifier = definition?.validator === CLASSIFIER_VALIDATOR && void 0 === definition.byoValidatorName;
|
|
26
|
+
const [missingQuestions, setMissingQuestions] = useState(false);
|
|
27
|
+
const renderParameter = useCallback((ctx)=>{
|
|
28
|
+
if (!isClassifier) return;
|
|
29
|
+
const { definition: parameter, parameters } = ctx;
|
|
30
|
+
const valueFor = (id)=>parameters.find((p)=>p.id === id)?.value;
|
|
31
|
+
switch(parameter.id){
|
|
32
|
+
case selectedQuestions:
|
|
33
|
+
{
|
|
34
|
+
const stored = valueFor(questionThresholds);
|
|
35
|
+
return /*#__PURE__*/ jsx(ClassifierQuestionPicker, {
|
|
36
|
+
parameter: parameter,
|
|
37
|
+
categories: categories,
|
|
38
|
+
selectedQuestions: Array.isArray(ctx.value) ? ctx.value : [],
|
|
39
|
+
questionThresholds: stored && 'object' == typeof stored && !Array.isArray(stored) ? stored : {},
|
|
40
|
+
error: ctx.error ?? (missingQuestions ? labels.questionsRequired : void 0),
|
|
41
|
+
labels: labelOverrides,
|
|
42
|
+
onChange: (names, thresholds)=>{
|
|
43
|
+
setMissingQuestions(false);
|
|
44
|
+
const withNames = upsert(parameters, selectedQuestions, names.length > 0 ? {
|
|
45
|
+
$parameterType: 'enum-list',
|
|
46
|
+
id: selectedQuestions,
|
|
47
|
+
value: names
|
|
48
|
+
} : void 0);
|
|
49
|
+
ctx.onParametersChange(upsert(withNames, questionThresholds, Object.keys(thresholds).length > 0 ? {
|
|
50
|
+
$parameterType: 'map-enum',
|
|
51
|
+
id: questionThresholds,
|
|
52
|
+
value: thresholds
|
|
53
|
+
} : void 0));
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
case questionThresholds:
|
|
58
|
+
return ctx.error ? /*#__PURE__*/ jsx(FormFieldError, {
|
|
59
|
+
children: `${parameter.label}: ${ctx.error}`
|
|
60
|
+
}) : null;
|
|
61
|
+
case questions:
|
|
62
|
+
return /*#__PURE__*/ jsx(ClassifierCustomQuestionsEditor, {
|
|
63
|
+
parameter: parameter,
|
|
64
|
+
rows: readClassifierCustomQuestions(parameters),
|
|
65
|
+
error: ctx.error,
|
|
66
|
+
labels: labelOverrides,
|
|
67
|
+
onRowsChange: (rows)=>{
|
|
68
|
+
setMissingQuestions(false);
|
|
69
|
+
ctx.onParametersChange(writeClassifierCustomQuestions(parameters, rows));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
case modelVendor:
|
|
73
|
+
{
|
|
74
|
+
const chosen = valueFor(model);
|
|
75
|
+
return 'string' == typeof chosen && '' !== chosen.trim() && ctx.error ? /*#__PURE__*/ jsx(FormFieldError, {
|
|
76
|
+
children: labels.modelVendorMissing
|
|
77
|
+
}) : null;
|
|
78
|
+
}
|
|
79
|
+
default:
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
}, [
|
|
83
|
+
isClassifier,
|
|
84
|
+
categories,
|
|
85
|
+
labels,
|
|
86
|
+
labelOverrides,
|
|
87
|
+
missingQuestions
|
|
88
|
+
]);
|
|
89
|
+
const validateParameters = useCallback((parameters)=>{
|
|
90
|
+
const ok = !isClassifier || hasClassifierQuestions(parameters);
|
|
91
|
+
setMissingQuestions(!ok);
|
|
92
|
+
return ok;
|
|
93
|
+
}, [
|
|
94
|
+
isClassifier
|
|
95
|
+
]);
|
|
96
|
+
return {
|
|
97
|
+
overrideParameterIds: isClassifier ? CLAIMED_IDS : NOTHING_CLAIMED,
|
|
98
|
+
renderParameter,
|
|
99
|
+
validateParameters
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export { useClassifierGuardrailParameters };
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
CLASSIFIER_QUESTIONS_PATH: ()=>CLASSIFIER_QUESTIONS_PATH,
|
|
28
|
+
useClassifierQuestions: ()=>useClassifierQuestions
|
|
29
|
+
});
|
|
30
|
+
const external_react_namespaceObject = require("react");
|
|
31
|
+
const external_definitions_copy_cjs_namespaceObject = require("./definitions-copy.cjs");
|
|
32
|
+
const external_definitions_parse_cjs_namespaceObject = require("./definitions-parse.cjs");
|
|
33
|
+
const external_use_guardrails_request_cjs_namespaceObject = require("./use-guardrails-request.cjs");
|
|
34
|
+
const CLASSIFIER_QUESTIONS_PATH = '/api/execution/guardrails/classifier-questions';
|
|
35
|
+
const EMPTY_RESULT = {
|
|
36
|
+
groups: [],
|
|
37
|
+
invalid: []
|
|
38
|
+
};
|
|
39
|
+
function toCategory(group, headings) {
|
|
40
|
+
return {
|
|
41
|
+
id: group.id,
|
|
42
|
+
label: Object.hasOwn(headings, group.id) && headings[group.id] || group.id,
|
|
43
|
+
questions: group.questions.map(({ criteriaTrue, criteriaFalse, levels, ...question })=>({
|
|
44
|
+
...question,
|
|
45
|
+
...null != criteriaTrue ? {
|
|
46
|
+
criteriaTrue
|
|
47
|
+
} : {},
|
|
48
|
+
...null != criteriaFalse ? {
|
|
49
|
+
criteriaFalse
|
|
50
|
+
} : {},
|
|
51
|
+
...null != levels ? {
|
|
52
|
+
levels
|
|
53
|
+
} : {}
|
|
54
|
+
}))
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function useClassifierQuestions(ctx, options = {}) {
|
|
58
|
+
const { questions: provided, copy: copyOverride, enabled = true } = options;
|
|
59
|
+
const linguiCopy = (0, external_definitions_copy_cjs_namespaceObject.useGuardrailDefinitionCopy)();
|
|
60
|
+
const copy = copyOverride ?? linguiCopy;
|
|
61
|
+
const { data: fetched, loading, error, refetch } = (0, external_use_guardrails_request_cjs_namespaceObject.useGuardrailsRequest)(ctx, {
|
|
62
|
+
path: CLASSIFIER_QUESTIONS_PATH,
|
|
63
|
+
endpointName: 'Classifier questions',
|
|
64
|
+
parse: external_definitions_parse_cjs_namespaceObject.parseClassifierQuestions,
|
|
65
|
+
empty: EMPTY_RESULT,
|
|
66
|
+
enabled: enabled && void 0 === provided
|
|
67
|
+
});
|
|
68
|
+
const parsed = (0, external_react_namespaceObject.useMemo)(()=>void 0 === provided ? fetched : (0, external_definitions_parse_cjs_namespaceObject.parseClassifierQuestions)(provided), [
|
|
69
|
+
provided,
|
|
70
|
+
fetched
|
|
71
|
+
]);
|
|
72
|
+
const categories = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
73
|
+
const headings = copy.classifier?.categoryLabels ?? {};
|
|
74
|
+
return parsed.groups.map((group)=>toCategory(group, headings));
|
|
75
|
+
}, [
|
|
76
|
+
parsed.groups,
|
|
77
|
+
copy
|
|
78
|
+
]);
|
|
79
|
+
return {
|
|
80
|
+
categories,
|
|
81
|
+
wire: parsed.groups,
|
|
82
|
+
invalid: parsed.invalid,
|
|
83
|
+
inputError: parsed.inputError,
|
|
84
|
+
loading,
|
|
85
|
+
error,
|
|
86
|
+
refetch
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
exports.CLASSIFIER_QUESTIONS_PATH = __webpack_exports__.CLASSIFIER_QUESTIONS_PATH;
|
|
90
|
+
exports.useClassifierQuestions = __webpack_exports__.useClassifierQuestions;
|
|
91
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
92
|
+
"CLASSIFIER_QUESTIONS_PATH",
|
|
93
|
+
"useClassifierQuestions"
|
|
94
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
95
|
+
Object.defineProperty(exports, '__esModule', {
|
|
96
|
+
value: true
|
|
97
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type GuardrailCopyTable } from './definitions-copy';
|
|
2
|
+
import { type ClassifierQuestionsParseResult } from './definitions-parse';
|
|
3
|
+
import type { ClassifierQuestionGroupWire } from './definitions-wire';
|
|
4
|
+
import { type GuardrailDefinitionsRequestContext } from './use-guardrails-request';
|
|
5
|
+
export declare const CLASSIFIER_QUESTIONS_PATH = "/api/execution/guardrails/classifier-questions";
|
|
6
|
+
export interface ClassifierQuestion {
|
|
7
|
+
name: string;
|
|
8
|
+
question: string;
|
|
9
|
+
type: 'noul' | 'score';
|
|
10
|
+
criteriaTrue?: string;
|
|
11
|
+
criteriaFalse?: string;
|
|
12
|
+
levels?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface ClassifierQuestionCategory {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
questions: ClassifierQuestion[];
|
|
18
|
+
}
|
|
19
|
+
export interface UseClassifierQuestionsOptions {
|
|
20
|
+
questions?: unknown;
|
|
21
|
+
copy?: GuardrailCopyTable;
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface UseClassifierQuestionsResult {
|
|
25
|
+
categories: ClassifierQuestionCategory[];
|
|
26
|
+
wire: ClassifierQuestionGroupWire[];
|
|
27
|
+
invalid: ClassifierQuestionsParseResult['invalid'];
|
|
28
|
+
inputError?: string;
|
|
29
|
+
loading: boolean;
|
|
30
|
+
error: Error | null;
|
|
31
|
+
refetch: () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare function useClassifierQuestions(ctx: GuardrailDefinitionsRequestContext | null, options?: UseClassifierQuestionsOptions): UseClassifierQuestionsResult;
|
|
34
|
+
//# sourceMappingURL=use-classifier-questions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-classifier-questions.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/use-classifier-questions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAA8B,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,KAAK,8BAA8B,EAA4B,MAAM,qBAAqB,CAAC;AACpG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EACL,KAAK,kCAAkC,EAExC,MAAM,0BAA0B,CAAC;AAElC,eAAO,MAAM,yBAAyB,mDAAmD,CAAC;AAG1F,MAAM,WAAW,kBAAkB;IAEjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,kBAAkB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,6BAA6B;IAE5C,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAE1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,4BAA4B;IAC3C,UAAU,EAAE,0BAA0B,EAAE,CAAC;IACzC,IAAI,EAAE,2BAA2B,EAAE,CAAC;IACpC,OAAO,EAAE,8BAA8B,CAAC,SAAS,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAyBD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,kCAAkC,GAAG,IAAI,EAC9C,OAAO,GAAE,6BAAkC,GAC1C,4BAA4B,CAoC9B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useGuardrailDefinitionCopy } from "./definitions-copy.js";
|
|
3
|
+
import { parseClassifierQuestions } from "./definitions-parse.js";
|
|
4
|
+
import { useGuardrailsRequest } from "./use-guardrails-request.js";
|
|
5
|
+
const CLASSIFIER_QUESTIONS_PATH = '/api/execution/guardrails/classifier-questions';
|
|
6
|
+
const EMPTY_RESULT = {
|
|
7
|
+
groups: [],
|
|
8
|
+
invalid: []
|
|
9
|
+
};
|
|
10
|
+
function toCategory(group, headings) {
|
|
11
|
+
return {
|
|
12
|
+
id: group.id,
|
|
13
|
+
label: Object.hasOwn(headings, group.id) && headings[group.id] || group.id,
|
|
14
|
+
questions: group.questions.map(({ criteriaTrue, criteriaFalse, levels, ...question })=>({
|
|
15
|
+
...question,
|
|
16
|
+
...null != criteriaTrue ? {
|
|
17
|
+
criteriaTrue
|
|
18
|
+
} : {},
|
|
19
|
+
...null != criteriaFalse ? {
|
|
20
|
+
criteriaFalse
|
|
21
|
+
} : {},
|
|
22
|
+
...null != levels ? {
|
|
23
|
+
levels
|
|
24
|
+
} : {}
|
|
25
|
+
}))
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function useClassifierQuestions(ctx, options = {}) {
|
|
29
|
+
const { questions: provided, copy: copyOverride, enabled = true } = options;
|
|
30
|
+
const linguiCopy = useGuardrailDefinitionCopy();
|
|
31
|
+
const copy = copyOverride ?? linguiCopy;
|
|
32
|
+
const { data: fetched, loading, error, refetch } = useGuardrailsRequest(ctx, {
|
|
33
|
+
path: CLASSIFIER_QUESTIONS_PATH,
|
|
34
|
+
endpointName: 'Classifier questions',
|
|
35
|
+
parse: parseClassifierQuestions,
|
|
36
|
+
empty: EMPTY_RESULT,
|
|
37
|
+
enabled: enabled && void 0 === provided
|
|
38
|
+
});
|
|
39
|
+
const parsed = useMemo(()=>void 0 === provided ? fetched : parseClassifierQuestions(provided), [
|
|
40
|
+
provided,
|
|
41
|
+
fetched
|
|
42
|
+
]);
|
|
43
|
+
const categories = useMemo(()=>{
|
|
44
|
+
const headings = copy.classifier?.categoryLabels ?? {};
|
|
45
|
+
return parsed.groups.map((group)=>toCategory(group, headings));
|
|
46
|
+
}, [
|
|
47
|
+
parsed.groups,
|
|
48
|
+
copy
|
|
49
|
+
]);
|
|
50
|
+
return {
|
|
51
|
+
categories,
|
|
52
|
+
wire: parsed.groups,
|
|
53
|
+
invalid: parsed.invalid,
|
|
54
|
+
inputError: parsed.inputError,
|
|
55
|
+
loading,
|
|
56
|
+
error,
|
|
57
|
+
refetch
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export { CLASSIFIER_QUESTIONS_PATH, useClassifierQuestions };
|
|
@@ -31,96 +31,23 @@ const external_react_namespaceObject = require("react");
|
|
|
31
31
|
const external_definitions_copy_cjs_namespaceObject = require("./definitions-copy.cjs");
|
|
32
32
|
const external_definitions_enrich_cjs_namespaceObject = require("./definitions-enrich.cjs");
|
|
33
33
|
const external_definitions_parse_cjs_namespaceObject = require("./definitions-parse.cjs");
|
|
34
|
+
const external_use_guardrails_request_cjs_namespaceObject = require("./use-guardrails-request.cjs");
|
|
34
35
|
const GUARDRAIL_DEFINITIONS_PATH = '/api/execution/guardrails/definitions';
|
|
35
36
|
const EMPTY_RESULT = {
|
|
36
37
|
definitions: [],
|
|
37
38
|
invalid: []
|
|
38
39
|
};
|
|
39
|
-
const NOTHING_SETTLED = {
|
|
40
|
-
key: 'none',
|
|
41
|
-
result: EMPTY_RESULT,
|
|
42
|
-
error: null
|
|
43
|
-
};
|
|
44
40
|
function useGuardrailDefinitions(ctx, options = {}) {
|
|
45
41
|
const { definitions: provided, hiddenValidators, copy: copyOverride, enabled: enabledOption = true } = options;
|
|
46
42
|
const linguiCopy = (0, external_definitions_copy_cjs_namespaceObject.useGuardrailDefinitionCopy)();
|
|
47
43
|
const copy = copyOverride ?? linguiCopy;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
const { data: fetched, loading, error, refetch } = (0, external_use_guardrails_request_cjs_namespaceObject.useGuardrailsRequest)(ctx, {
|
|
45
|
+
path: GUARDRAIL_DEFINITIONS_PATH,
|
|
46
|
+
endpointName: 'Guardrail definitions',
|
|
47
|
+
parse: external_definitions_parse_cjs_namespaceObject.parseGuardrailDefinitions,
|
|
48
|
+
empty: EMPTY_RESULT,
|
|
49
|
+
enabled: enabledOption && void 0 === provided
|
|
54
50
|
});
|
|
55
|
-
const request = (0, external_react_namespaceObject.useMemo)(()=>'' === requestKey ? null : JSON.parse(requestKey), [
|
|
56
|
-
requestKey
|
|
57
|
-
]);
|
|
58
|
-
const fetchRef = (0, external_react_namespaceObject.useRef)(ctx?.fetch);
|
|
59
|
-
fetchRef.current = ctx?.fetch;
|
|
60
|
-
const enabled = enabledOption && void 0 === provided && null !== request;
|
|
61
|
-
const [settled, setSettled] = (0, external_react_namespaceObject.useState)(NOTHING_SETTLED);
|
|
62
|
-
const [inFlight, setInFlight] = (0, external_react_namespaceObject.useState)(false);
|
|
63
|
-
const abortRef = (0, external_react_namespaceObject.useRef)(null);
|
|
64
|
-
const isCurrent = enabled && settled.key === requestKey;
|
|
65
|
-
const fetched = isCurrent ? settled.result : EMPTY_RESULT;
|
|
66
|
-
const error = isCurrent ? settled.error : null;
|
|
67
|
-
const loading = enabled && (inFlight || !isCurrent);
|
|
68
|
-
const load = (0, external_react_namespaceObject.useCallback)(async ()=>{
|
|
69
|
-
if (!enabled || null === request) return;
|
|
70
|
-
abortRef.current?.abort();
|
|
71
|
-
const controller = new AbortController();
|
|
72
|
-
abortRef.current = controller;
|
|
73
|
-
const key = requestKey;
|
|
74
|
-
setInFlight(true);
|
|
75
|
-
const base = (request.baseUrl ?? '').replace(/\/$/, '');
|
|
76
|
-
const headers = {
|
|
77
|
-
Accept: 'application/json',
|
|
78
|
-
'X-UiPath-Internal-TenantId': request.tenantId
|
|
79
|
-
};
|
|
80
|
-
if (request.token) headers.Authorization = `Bearer ${request.token}`;
|
|
81
|
-
if (request.accountId) headers['X-UiPath-Internal-AccountId'] = request.accountId;
|
|
82
|
-
Object.assign(headers, request.headers);
|
|
83
|
-
const doFetch = fetchRef.current ?? ((input, init)=>globalThis.fetch(input, init));
|
|
84
|
-
try {
|
|
85
|
-
const response = await doFetch(`${base}${GUARDRAIL_DEFINITIONS_PATH}`, {
|
|
86
|
-
headers,
|
|
87
|
-
signal: controller.signal
|
|
88
|
-
});
|
|
89
|
-
if (!response.ok) throw new Error(`Guardrail definitions API ${response.status} ${response.statusText}`);
|
|
90
|
-
const payload = await response.json();
|
|
91
|
-
if (!controller.signal.aborted) setSettled({
|
|
92
|
-
key,
|
|
93
|
-
result: (0, external_definitions_parse_cjs_namespaceObject.parseGuardrailDefinitions)(payload),
|
|
94
|
-
error: null
|
|
95
|
-
});
|
|
96
|
-
} catch (err) {
|
|
97
|
-
if (err?.name === 'AbortError') return;
|
|
98
|
-
if (!controller.signal.aborted) setSettled((prev)=>({
|
|
99
|
-
key,
|
|
100
|
-
result: prev.key === key ? prev.result : EMPTY_RESULT,
|
|
101
|
-
error: err instanceof Error ? err : new Error(String(err))
|
|
102
|
-
}));
|
|
103
|
-
} finally{
|
|
104
|
-
if (!controller.signal.aborted) setInFlight(false);
|
|
105
|
-
}
|
|
106
|
-
}, [
|
|
107
|
-
enabled,
|
|
108
|
-
request,
|
|
109
|
-
requestKey
|
|
110
|
-
]);
|
|
111
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
112
|
-
if (!enabled) {
|
|
113
|
-
abortRef.current?.abort();
|
|
114
|
-
setInFlight(false);
|
|
115
|
-
setSettled((prev)=>prev === NOTHING_SETTLED ? prev : NOTHING_SETTLED);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
load();
|
|
119
|
-
return ()=>abortRef.current?.abort();
|
|
120
|
-
}, [
|
|
121
|
-
enabled,
|
|
122
|
-
load
|
|
123
|
-
]);
|
|
124
51
|
const parsed = (0, external_react_namespaceObject.useMemo)(()=>void 0 === provided ? fetched : (0, external_definitions_parse_cjs_namespaceObject.parseGuardrailDefinitions)(provided), [
|
|
125
52
|
provided,
|
|
126
53
|
fetched
|
|
@@ -144,7 +71,7 @@ function useGuardrailDefinitions(ctx, options = {}) {
|
|
|
144
71
|
inputError: parsed.inputError,
|
|
145
72
|
loading,
|
|
146
73
|
error,
|
|
147
|
-
refetch
|
|
74
|
+
refetch
|
|
148
75
|
};
|
|
149
76
|
}
|
|
150
77
|
exports.GUARDRAIL_DEFINITIONS_PATH = __webpack_exports__.GUARDRAIL_DEFINITIONS_PATH;
|
|
@@ -2,15 +2,9 @@ import { type GuardrailCopyTable } from './definitions-copy';
|
|
|
2
2
|
import { type EnrichedGuardrailDefinition } from './definitions-enrich';
|
|
3
3
|
import { type GuardrailDefinitionParseIssue } from './definitions-parse';
|
|
4
4
|
import type { GuardrailDefinitionWire } from './definitions-wire';
|
|
5
|
+
import { type GuardrailDefinitionsRequestContext } from './use-guardrails-request';
|
|
6
|
+
export type { GuardrailDefinitionsRequestContext } from './use-guardrails-request';
|
|
5
7
|
export declare const GUARDRAIL_DEFINITIONS_PATH = "/api/execution/guardrails/definitions";
|
|
6
|
-
export interface GuardrailDefinitionsRequestContext {
|
|
7
|
-
baseUrl?: string;
|
|
8
|
-
token?: string;
|
|
9
|
-
tenantId: string;
|
|
10
|
-
accountId?: string;
|
|
11
|
-
headers?: Record<string, string>;
|
|
12
|
-
fetch?: typeof fetch;
|
|
13
|
-
}
|
|
14
8
|
export interface UseGuardrailDefinitionsOptions {
|
|
15
9
|
definitions?: unknown;
|
|
16
10
|
hiddenValidators?: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-guardrail-definitions.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/use-guardrail-definitions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAA8B,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,KAAK,2BAA2B,EAA8B,MAAM,sBAAsB,CAAC;AACpG,OAAO,EACL,KAAK,6BAA6B,EAGnC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-guardrail-definitions.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/use-guardrail-definitions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAA8B,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,KAAK,2BAA2B,EAA8B,MAAM,sBAAsB,CAAC;AACpG,OAAO,EACL,KAAK,6BAA6B,EAGnC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EACL,KAAK,kCAAkC,EAExC,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,kCAAkC,EAAE,MAAM,0BAA0B,CAAC;AAGnF,eAAO,MAAM,0BAA0B,0CAA0C,CAAC;AAElF,MAAM,WAAW,8BAA8B;IAU7C,WAAW,CAAC,EAAE,OAAO,CAAC;IAItB,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAMrC,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAU1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,6BAA6B;IAE5C,WAAW,EAAE,2BAA2B,EAAE,CAAC;IAE3C,IAAI,EAAE,uBAAuB,EAAE,CAAC;IAEhC,OAAO,EAAE,6BAA6B,EAAE,CAAC;IAEzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IAEjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAwBD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,kCAAkC,GAAG,IAAI,EAC9C,OAAO,GAAE,8BAAmC,GAC3C,6BAA6B,CAwD/B"}
|