@uipath/apollo-react 6.47.4 → 6.49.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.
Files changed (57) hide show
  1. package/dist/canvas/components/Guardrails/__fixtures__/catalog-coverage.cjs +83 -0
  2. package/dist/canvas/components/Guardrails/__fixtures__/catalog-coverage.d.ts +8 -0
  3. package/dist/canvas/components/Guardrails/__fixtures__/catalog-coverage.d.ts.map +1 -0
  4. package/dist/canvas/components/Guardrails/__fixtures__/catalog-coverage.js +37 -0
  5. package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.cjs +344 -0
  6. package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.d.ts +13 -0
  7. package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.d.ts.map +1 -0
  8. package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.js +280 -0
  9. package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.cjs +221 -0
  10. package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.d.ts +4 -0
  11. package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.d.ts.map +1 -0
  12. package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.js +184 -0
  13. package/dist/canvas/components/Guardrails/builder-types.d.ts.map +1 -1
  14. package/dist/canvas/components/Guardrails/components/guardrail-chip.cjs +5 -1
  15. package/dist/canvas/components/Guardrails/components/guardrail-chip.d.ts +1 -0
  16. package/dist/canvas/components/Guardrails/components/guardrail-chip.d.ts.map +1 -1
  17. package/dist/canvas/components/Guardrails/components/guardrail-chip.js +3 -2
  18. package/dist/canvas/components/Guardrails/components/guardrail-status-chip.cjs +60 -0
  19. package/dist/canvas/components/Guardrails/components/guardrail-status-chip.d.ts +7 -0
  20. package/dist/canvas/components/Guardrails/components/guardrail-status-chip.d.ts.map +1 -0
  21. package/dist/canvas/components/Guardrails/components/guardrail-status-chip.js +26 -0
  22. package/dist/canvas/components/Guardrails/definitions-copy.cjs +369 -0
  23. package/dist/canvas/components/Guardrails/definitions-copy.d.ts +14 -0
  24. package/dist/canvas/components/Guardrails/definitions-copy.d.ts.map +1 -0
  25. package/dist/canvas/components/Guardrails/definitions-copy.js +326 -0
  26. package/dist/canvas/components/Guardrails/definitions-enrich.cjs +173 -0
  27. package/dist/canvas/components/Guardrails/definitions-enrich.d.ts +30 -0
  28. package/dist/canvas/components/Guardrails/definitions-enrich.d.ts.map +1 -0
  29. package/dist/canvas/components/Guardrails/definitions-enrich.js +130 -0
  30. package/dist/canvas/components/Guardrails/definitions-parse.cjs +199 -0
  31. package/dist/canvas/components/Guardrails/definitions-parse.d.ts +13 -0
  32. package/dist/canvas/components/Guardrails/definitions-parse.d.ts.map +1 -0
  33. package/dist/canvas/components/Guardrails/definitions-parse.js +165 -0
  34. package/dist/canvas/components/Guardrails/definitions-wire.cjs +18 -0
  35. package/dist/canvas/components/Guardrails/definitions-wire.d.ts +59 -0
  36. package/dist/canvas/components/Guardrails/definitions-wire.d.ts.map +1 -0
  37. package/dist/canvas/components/Guardrails/definitions-wire.js +0 -0
  38. package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -1
  39. package/dist/canvas/components/Guardrails/index.cjs +49 -8
  40. package/dist/canvas/components/Guardrails/index.d.ts +11 -0
  41. package/dist/canvas/components/Guardrails/index.d.ts.map +1 -1
  42. package/dist/canvas/components/Guardrails/index.js +6 -1
  43. package/dist/canvas/components/Guardrails/types.d.ts.map +1 -1
  44. package/dist/canvas/components/Guardrails/use-guardrail-definitions.cjs +158 -0
  45. package/dist/canvas/components/Guardrails/use-guardrail-definitions.d.ts +30 -0
  46. package/dist/canvas/components/Guardrails/use-guardrail-definitions.d.ts.map +1 -0
  47. package/dist/canvas/components/Guardrails/use-guardrail-definitions.js +121 -0
  48. package/dist/canvas/components/JsonTree/JsonContainerEditor.cjs +1 -1
  49. package/dist/canvas/components/JsonTree/JsonContainerEditor.js +1 -1
  50. package/dist/canvas/components/NodePropertyPanel/PanelField.cjs +1 -1
  51. package/dist/canvas/components/NodePropertyPanel/PanelField.d.ts.map +1 -1
  52. package/dist/canvas/components/NodePropertyPanel/PanelField.js +1 -1
  53. package/dist/canvas/locales/en.cjs +1 -1
  54. package/dist/canvas/locales/en.d.ts.map +1 -1
  55. package/dist/canvas/locales/en.js +1 -1
  56. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  57. package/package.json +3 -3
@@ -0,0 +1,326 @@
1
+ import { useMemo } from "react";
2
+ import { useSafeLingui } from "../../../i18n/index.js";
3
+ function buildGuardrailCopy(_) {
4
+ return {
5
+ pii_detection: {
6
+ displayName: _({
7
+ id: 'guardrails.definitions.pii_detection.display-name',
8
+ message: 'PII detection'
9
+ }),
10
+ description: _({
11
+ id: "guardrails.definitions.pii_detection.description",
12
+ message: 'Detect personally identifiable information using Azure Cognitive Services.'
13
+ }),
14
+ paramLabels: {
15
+ entities: _({
16
+ id: 'guardrails.definitions.pii_detection.param.entities.label',
17
+ message: 'Entities to detect'
18
+ }),
19
+ entityThresholds: _({
20
+ id: 'guardrails.definitions.pii_detection.param.entityThresholds.label',
21
+ message: 'Detection thresholds'
22
+ })
23
+ },
24
+ paramTooltips: {
25
+ entityThresholds: _({
26
+ id: 'guardrails.definitions.pii_detection.param.entityThresholds.tooltip',
27
+ message: 'Value between 0 and 1. The sensitivity level for PII detection. Higher thresholds detect more potential PII but may result in more false positives.'
28
+ })
29
+ },
30
+ optionLabels: {
31
+ entities: {
32
+ Person: _({
33
+ id: 'guardrails.definitions.pii_detection.option.entities.Person',
34
+ message: 'Person'
35
+ }),
36
+ Address: _({
37
+ id: 'guardrails.definitions.pii_detection.option.entities.Address',
38
+ message: 'Address'
39
+ }),
40
+ Date: _({
41
+ id: 'guardrails.definitions.pii_detection.option.entities.Date',
42
+ message: 'Date'
43
+ }),
44
+ PhoneNumber: _({
45
+ id: 'guardrails.definitions.pii_detection.option.entities.PhoneNumber',
46
+ message: 'Phone Number'
47
+ }),
48
+ EugpsCoordinates: _({
49
+ id: 'guardrails.definitions.pii_detection.option.entities.EugpsCoordinates',
50
+ message: 'EU GPS Coordinates'
51
+ }),
52
+ Email: _({
53
+ id: 'guardrails.definitions.pii_detection.option.entities.Email',
54
+ message: 'Email'
55
+ }),
56
+ CreditCardNumber: _({
57
+ id: 'guardrails.definitions.pii_detection.option.entities.CreditCardNumber',
58
+ message: 'Credit Card Number'
59
+ }),
60
+ InternationalBankingAccountNumber: _({
61
+ id: 'guardrails.definitions.pii_detection.option.entities.InternationalBankingAccountNumber',
62
+ message: 'International Banking Account Number (IBAN)'
63
+ }),
64
+ SwiftCode: _({
65
+ id: 'guardrails.definitions.pii_detection.option.entities.SwiftCode',
66
+ message: 'SWIFT Code'
67
+ }),
68
+ ABARoutingNumber: _({
69
+ id: 'guardrails.definitions.pii_detection.option.entities.ABARoutingNumber',
70
+ message: 'ABA Routing Number'
71
+ }),
72
+ USDriversLicenseNumber: _({
73
+ id: 'guardrails.definitions.pii_detection.option.entities.USDriversLicenseNumber',
74
+ message: "US Driver's License Number"
75
+ }),
76
+ UKDriversLicenseNumber: _({
77
+ id: 'guardrails.definitions.pii_detection.option.entities.UKDriversLicenseNumber',
78
+ message: "UK Driver's License Number"
79
+ }),
80
+ USIndividualTaxpayerIdentification: _({
81
+ id: 'guardrails.definitions.pii_detection.option.entities.USIndividualTaxpayerIdentification',
82
+ message: 'US Individual Taxpayer Identification Number (ITIN)'
83
+ }),
84
+ UKUniqueTaxpayerNumber: _({
85
+ id: 'guardrails.definitions.pii_detection.option.entities.UKUniqueTaxpayerNumber',
86
+ message: 'UK Unique Taxpayer Number (UTR)'
87
+ }),
88
+ USBankAccountNumber: _({
89
+ id: 'guardrails.definitions.pii_detection.option.entities.USBankAccountNumber',
90
+ message: 'US Bank Account Number'
91
+ }),
92
+ USSocialSecurityNumber: _({
93
+ id: 'guardrails.definitions.pii_detection.option.entities.USSocialSecurityNumber',
94
+ message: 'US Social Security Number (SSN)'
95
+ }),
96
+ UsukPassportNumber: _({
97
+ id: 'guardrails.definitions.pii_detection.option.entities.UsukPassportNumber',
98
+ message: 'US/UK Passport Number'
99
+ }),
100
+ NOIdentityNumber: _({
101
+ id: 'guardrails.definitions.pii_detection.option.entities.NOIdentityNumber',
102
+ message: 'Norway Identity Number'
103
+ }),
104
+ FINationalID: _({
105
+ id: 'guardrails.definitions.pii_detection.option.entities.FINationalID',
106
+ message: 'Finland National ID'
107
+ }),
108
+ FIPassportNumber: _({
109
+ id: 'guardrails.definitions.pii_detection.option.entities.FIPassportNumber',
110
+ message: 'Finland Passport Number'
111
+ }),
112
+ SENationalID: _({
113
+ id: 'guardrails.definitions.pii_detection.option.entities.SENationalID',
114
+ message: 'Sweden National ID'
115
+ }),
116
+ DKPersonalIdentificationNumber: _({
117
+ id: 'guardrails.definitions.pii_detection.option.entities.DKPersonalIdentificationNumber',
118
+ message: 'Danish Personal Identification Number'
119
+ }),
120
+ NLCitizensServiceNumber: _({
121
+ id: 'guardrails.definitions.pii_detection.option.entities.NLCitizensServiceNumber',
122
+ message: 'Netherlands Citizens Service Number'
123
+ }),
124
+ URL: _({
125
+ id: 'guardrails.definitions.pii_detection.option.entities.URL',
126
+ message: 'URL'
127
+ }),
128
+ IPAddress: _({
129
+ id: 'guardrails.definitions.pii_detection.option.entities.IPAddress',
130
+ message: 'IP Address'
131
+ })
132
+ }
133
+ }
134
+ },
135
+ prompt_injection: {
136
+ displayName: _({
137
+ id: 'guardrails.definitions.prompt_injection.display-name',
138
+ message: 'Prompt injection'
139
+ }),
140
+ description: _({
141
+ id: "guardrails.definitions.prompt_injection.description",
142
+ message: 'This validator is provided by Noma Security and is built to detect malicious attack attempts (e.g. prompt injection, jailbreak) in LLM calls.'
143
+ }),
144
+ paramLabels: {
145
+ threshold: _({
146
+ id: 'guardrails.definitions.prompt_injection.param.threshold.label',
147
+ message: 'Detection threshold'
148
+ })
149
+ },
150
+ paramTooltips: {
151
+ threshold: _({
152
+ id: 'guardrails.definitions.prompt_injection.param.threshold.tooltip',
153
+ message: 'Value between 0 and 1. The sensitivity level for Prompt Injection detection. Higher thresholds detect more potential Prompt Injection but may result in more false positives.'
154
+ })
155
+ }
156
+ },
157
+ harmful_content: {
158
+ displayName: _({
159
+ id: 'guardrails.definitions.harmful_content.display-name',
160
+ message: 'Harmful content'
161
+ }),
162
+ description: _({
163
+ id: "guardrails.definitions.harmful_content.description",
164
+ message: 'Detect harmful content (e.g. hate, violence) using Azure AI Content Safety.'
165
+ }),
166
+ paramLabels: {
167
+ harmfulContentEntities: _({
168
+ id: 'guardrails.definitions.harmful_content.param.harmfulContentEntities.label',
169
+ message: 'Content categories'
170
+ }),
171
+ harmfulContentEntityThresholds: _({
172
+ id: 'guardrails.definitions.harmful_content.param.harmfulContentEntityThresholds.label',
173
+ message: 'Severity thresholds'
174
+ })
175
+ },
176
+ paramTooltips: {
177
+ harmfulContentEntityThresholds: _({
178
+ id: 'guardrails.definitions.harmful_content.param.harmfulContentEntityThresholds.tooltip',
179
+ message: 'Integer value between 0 and 6 (step 2). The severity threshold for harmful content detection. Higher values require more severe content before triggering.'
180
+ })
181
+ },
182
+ optionLabels: {
183
+ harmfulContentEntities: {
184
+ Hate: _({
185
+ id: 'guardrails.definitions.harmful_content.option.harmfulContentEntities.Hate',
186
+ message: 'Hate'
187
+ }),
188
+ SelfHarm: _({
189
+ id: 'guardrails.definitions.harmful_content.option.harmfulContentEntities.SelfHarm',
190
+ message: 'Self-harm'
191
+ }),
192
+ Sexual: _({
193
+ id: 'guardrails.definitions.harmful_content.option.harmfulContentEntities.Sexual',
194
+ message: 'Sexual'
195
+ }),
196
+ Violence: _({
197
+ id: 'guardrails.definitions.harmful_content.option.harmfulContentEntities.Violence',
198
+ message: 'Violence'
199
+ })
200
+ }
201
+ }
202
+ },
203
+ user_prompt_attacks: {
204
+ displayName: _({
205
+ id: 'guardrails.definitions.user_prompt_attacks.display-name',
206
+ message: 'User prompt attacks'
207
+ }),
208
+ description: _({
209
+ id: "guardrails.definitions.user_prompt_attacks.description",
210
+ message: 'Detect user prompt attacks that attempt to bypass system instructions using Azure AI Content Safety.'
211
+ }),
212
+ paramLabels: {}
213
+ },
214
+ intellectual_property: {
215
+ displayName: _({
216
+ id: 'guardrails.definitions.intellectual_property.display-name',
217
+ message: 'Intellectual property'
218
+ }),
219
+ description: _({
220
+ id: "guardrails.definitions.intellectual_property.description",
221
+ message: 'Detect potential intellectual property violations in text and code using Azure AI Content Safety.'
222
+ }),
223
+ paramLabels: {
224
+ ipEntities: _({
225
+ id: 'guardrails.definitions.intellectual_property.param.ipEntities.label',
226
+ message: 'Content types'
227
+ })
228
+ },
229
+ optionLabels: {
230
+ ipEntities: {
231
+ Text: _({
232
+ id: 'guardrails.definitions.intellectual_property.option.ipEntities.Text',
233
+ message: 'Text'
234
+ }),
235
+ Code: _({
236
+ id: 'guardrails.definitions.intellectual_property.option.ipEntities.Code',
237
+ message: 'Code'
238
+ })
239
+ }
240
+ }
241
+ },
242
+ llm_as_judge: {
243
+ displayName: _({
244
+ id: 'guardrails.definitions.llm_as_judge.display-name',
245
+ message: 'LLM as Judge'
246
+ }),
247
+ description: _({
248
+ id: "guardrails.definitions.llm_as_judge.description",
249
+ message: 'Detect violations of a rule you define, using an LLM as the judge.'
250
+ }),
251
+ usageNote: _({
252
+ id: 'guardrails.definitions.llm_as_judge.usage-note',
253
+ message: "Judge model calls consume Agent units the same way the agent's own LLM calls do. Apply selectively to keep cost predictable, and choose the judge model with cost in mind — rates vary by model."
254
+ }),
255
+ paramLabels: {
256
+ guardrailText: _({
257
+ id: 'guardrails.definitions.llm_as_judge.param.guardrailText.label',
258
+ message: 'Rule prompt'
259
+ }),
260
+ model: _({
261
+ id: 'guardrails.definitions.llm_as_judge.param.model.label',
262
+ message: 'Judge model'
263
+ }),
264
+ positiveExamples: _({
265
+ id: 'guardrails.definitions.llm_as_judge.param.positiveExamples.label',
266
+ message: 'Positive examples'
267
+ }),
268
+ negativeExamples: _({
269
+ id: 'guardrails.definitions.llm_as_judge.param.negativeExamples.label',
270
+ message: 'Negative examples'
271
+ }),
272
+ threshold: _({
273
+ id: 'guardrails.definitions.llm_as_judge.param.threshold.label',
274
+ message: 'Strictness'
275
+ })
276
+ },
277
+ paramTooltips: {
278
+ guardrailText: _({
279
+ id: 'guardrails.definitions.llm_as_judge.param.guardrailText.tooltip',
280
+ message: 'Describe the rule the judge will enforce. Be specific about what should pass and what should fail.'
281
+ }),
282
+ model: _({
283
+ id: 'guardrails.definitions.llm_as_judge.param.model.tooltip',
284
+ message: 'The model used to evaluate the policy against each payload.'
285
+ }),
286
+ positiveExamples: _({
287
+ id: 'guardrails.definitions.llm_as_judge.param.positiveExamples.tooltip',
288
+ message: 'Optional payloads that should pass the policy. Used by the judge as calibration anchors.'
289
+ }),
290
+ negativeExamples: _({
291
+ id: 'guardrails.definitions.llm_as_judge.param.negativeExamples.tooltip',
292
+ message: 'Optional payloads that should fail the policy. Used by the judge as calibration anchors.'
293
+ }),
294
+ threshold: _({
295
+ id: 'guardrails.definitions.llm_as_judge.param.threshold.tooltip',
296
+ message: 'Strictness on a 0–6 scale. Lower values are stricter — the judge flags anything that hints at a violation. Higher values are more lenient — only clear, unambiguous violations are flagged.'
297
+ })
298
+ }
299
+ }
300
+ };
301
+ }
302
+ const CURATED_GUARDRAIL_VALIDATORS = Object.freeze([
303
+ 'pii_detection',
304
+ 'prompt_injection',
305
+ 'harmful_content',
306
+ 'user_prompt_attacks',
307
+ 'intellectual_property',
308
+ 'llm_as_judge'
309
+ ]);
310
+ const GUARDRAIL_COPY_EN = buildGuardrailCopy((descriptor)=>descriptor.message);
311
+ function collectEnglishMessages() {
312
+ const messages = {};
313
+ buildGuardrailCopy((descriptor)=>{
314
+ messages[descriptor.id] = descriptor.message;
315
+ return descriptor.message;
316
+ });
317
+ return messages;
318
+ }
319
+ const GUARDRAIL_COPY_EN_MESSAGES = Object.freeze(collectEnglishMessages());
320
+ function useGuardrailDefinitionCopy() {
321
+ const { _ } = useSafeLingui();
322
+ return useMemo(()=>buildGuardrailCopy(_), [
323
+ _
324
+ ]);
325
+ }
326
+ export { CURATED_GUARDRAIL_VALIDATORS, GUARDRAIL_COPY_EN, GUARDRAIL_COPY_EN_MESSAGES, useGuardrailDefinitionCopy };
@@ -0,0 +1,173 @@
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
+ enrichGuardrailDefinitions: ()=>enrichGuardrailDefinitions,
28
+ withGuardrailFolderMetadata: ()=>withGuardrailFolderMetadata,
29
+ humanizeGuardrailParameterId: ()=>humanizeGuardrailParameterId,
30
+ isByoGuardrailDefinition: ()=>isByoGuardrailDefinition
31
+ });
32
+ const external_definitions_copy_cjs_namespaceObject = require("./definitions-copy.cjs");
33
+ function isByoGuardrailDefinition(definition) {
34
+ return void 0 !== definition.byoValidatorName;
35
+ }
36
+ function humanizeGuardrailParameterId(id) {
37
+ const words = [];
38
+ let word = '';
39
+ let allCaps = true;
40
+ const flush = ()=>{
41
+ if ('' !== word) words.push(word);
42
+ word = '';
43
+ allCaps = true;
44
+ };
45
+ for (const char of id){
46
+ const isUpper = char >= 'A' && char <= 'Z';
47
+ const isWordChar = isUpper || char >= 'a' && char <= 'z' || char >= '0' && char <= '9';
48
+ if (isWordChar) if (isUpper) {
49
+ if (!allCaps) flush();
50
+ word += char;
51
+ } else {
52
+ if (allCaps && word.length > 1) {
53
+ const carried = word.slice(-1);
54
+ word = word.slice(0, -1);
55
+ flush();
56
+ word = carried;
57
+ }
58
+ allCaps = false;
59
+ word += char;
60
+ }
61
+ else flush();
62
+ }
63
+ flush();
64
+ if (0 === words.length) return id;
65
+ const spaced = words.map((entry)=>entry.length > 1 && entry === entry.toUpperCase() ? entry : entry.toLowerCase()).join(' ');
66
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1);
67
+ }
68
+ function ownCopyEntry(table, key, isValid) {
69
+ if (void 0 === table || !Object.hasOwn(table, key)) return;
70
+ const value = table[key];
71
+ return isValid(value) ? value : void 0;
72
+ }
73
+ const isCopyString = (value)=>'string' == typeof value;
74
+ const isCopyRecord = (value)=>'object' == typeof value && null !== value;
75
+ function toParameterDefinition(param, curated) {
76
+ const definition = {
77
+ id: param.id,
78
+ type: param.type,
79
+ label: param.displayName ?? ownCopyEntry(curated?.paramLabels, param.id, isCopyString) ?? humanizeGuardrailParameterId(param.id),
80
+ required: param.required,
81
+ defaultValue: param.defaultValue
82
+ };
83
+ const tooltip = param.description ?? ownCopyEntry(curated?.paramTooltips, param.id, isCopyString);
84
+ if (void 0 !== tooltip) definition.tooltip = tooltip;
85
+ const curatedOptionLabels = ownCopyEntry(curated?.optionLabels, param.id, isCopyRecord);
86
+ const wireOptionLabels = 'enum' === param.type || 'enum-list' === param.type ? param.optionLabels : void 0;
87
+ if (void 0 !== curatedOptionLabels || void 0 !== wireOptionLabels) definition.optionLabels = {
88
+ ...curatedOptionLabels,
89
+ ...wireOptionLabels
90
+ };
91
+ switch(param.type){
92
+ case 'enum':
93
+ case 'enum-list':
94
+ definition.options = param.options;
95
+ break;
96
+ case 'map-enum':
97
+ definition.keySource = param.keySource;
98
+ if (null != param.min) definition.min = param.min;
99
+ if (null != param.max) definition.max = param.max;
100
+ definition.step = param.step ?? 0.1;
101
+ break;
102
+ case 'number':
103
+ if (null != param.min) definition.min = param.min;
104
+ if (null != param.max) definition.max = param.max;
105
+ if (null != param.step) definition.step = param.step;
106
+ break;
107
+ case 'text':
108
+ if (null != param.maxLength) definition.maxLength = param.maxLength;
109
+ break;
110
+ case 'text-list':
111
+ if (null != param.maxLength) definition.maxLength = param.maxLength;
112
+ if (null != param.maxItems) definition.maxItems = param.maxItems;
113
+ break;
114
+ default:
115
+ break;
116
+ }
117
+ return definition;
118
+ }
119
+ function enrichOne(wire, copy) {
120
+ const isByo = isByoGuardrailDefinition(wire);
121
+ const curated = isByo || !Object.hasOwn(copy, wire.validator) ? void 0 : copy[wire.validator];
122
+ const enriched = {
123
+ validator: wire.validator,
124
+ displayName: (isByo ? wire.displayName : curated?.displayName ?? wire.displayName) ?? wire.validator,
125
+ description: (isByo ? wire.description : curated?.description ?? wire.description) ?? '',
126
+ allowedScopes: wire.allowedScopes,
127
+ parameters: wire.parameters.map((param)=>toParameterDefinition(param, curated)),
128
+ status: wire.status
129
+ };
130
+ if (curated?.usageNote !== void 0) enriched.usageNote = curated.usageNote;
131
+ if (void 0 !== wire.byoValidatorName) enriched.byoValidatorName = wire.byoValidatorName;
132
+ if (void 0 !== wire.byoConnectorName) enriched.byoConnectorName = wire.byoConnectorName;
133
+ if (void 0 !== wire.byoConnectorKey) enriched.byoConnectorKey = wire.byoConnectorKey;
134
+ if (void 0 !== wire.byoGuardrailConnectionId) enriched.byoGuardrailConnectionId = wire.byoGuardrailConnectionId;
135
+ if (void 0 !== wire.byoConfigurationId) enriched.byoConfigurationId = wire.byoConfigurationId;
136
+ if (void 0 !== wire.folderPath) enriched.folderPath = wire.folderPath;
137
+ if (void 0 !== wire.folderKey) enriched.folderKey = wire.folderKey;
138
+ return enriched;
139
+ }
140
+ function enrichGuardrailDefinitions(definitions, options = {}) {
141
+ const copy = options.copy ?? external_definitions_copy_cjs_namespaceObject.GUARDRAIL_COPY_EN;
142
+ const hidden = new Set(options.hiddenValidators ?? []);
143
+ const result = [];
144
+ for (const wire of definitions)if (!(!isByoGuardrailDefinition(wire) && hidden.has(wire.validator))) result.push(enrichOne(wire, copy));
145
+ return result;
146
+ }
147
+ function withGuardrailFolderMetadata(definitions, resolve) {
148
+ return definitions.map((definition)=>{
149
+ const connectionId = definition.byoGuardrailConnectionId;
150
+ if (void 0 === connectionId) return definition;
151
+ const metadata = resolve(connectionId);
152
+ if (void 0 === metadata) return definition;
153
+ const next = {
154
+ ...definition
155
+ };
156
+ if (void 0 !== metadata.folderPath) next.folderPath = metadata.folderPath;
157
+ if (void 0 !== metadata.folderKey) next.folderKey = metadata.folderKey;
158
+ return next;
159
+ });
160
+ }
161
+ exports.enrichGuardrailDefinitions = __webpack_exports__.enrichGuardrailDefinitions;
162
+ exports.humanizeGuardrailParameterId = __webpack_exports__.humanizeGuardrailParameterId;
163
+ exports.isByoGuardrailDefinition = __webpack_exports__.isByoGuardrailDefinition;
164
+ exports.withGuardrailFolderMetadata = __webpack_exports__.withGuardrailFolderMetadata;
165
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
166
+ "enrichGuardrailDefinitions",
167
+ "humanizeGuardrailParameterId",
168
+ "isByoGuardrailDefinition",
169
+ "withGuardrailFolderMetadata"
170
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
171
+ Object.defineProperty(exports, '__esModule', {
172
+ value: true
173
+ });
@@ -0,0 +1,30 @@
1
+ import type { GuardrailDefinition } from './builder-types';
2
+ import { type GuardrailCopyTable } from './definitions-copy';
3
+ import type { GuardrailDefinitionWire } from './definitions-wire';
4
+ export interface EnrichedGuardrailDefinition extends GuardrailDefinition {
5
+ description: string;
6
+ usageNote?: string;
7
+ byoConnectorName?: string;
8
+ byoConnectorKey?: string;
9
+ byoGuardrailConnectionId?: string;
10
+ byoConfigurationId?: string;
11
+ folderPath?: string;
12
+ folderKey?: string;
13
+ }
14
+ export interface EnrichGuardrailDefinitionsOptions {
15
+ copy?: GuardrailCopyTable;
16
+ hiddenValidators?: readonly string[];
17
+ }
18
+ export declare function isByoGuardrailDefinition<T extends {
19
+ byoValidatorName?: string;
20
+ }>(definition: T): definition is T & {
21
+ byoValidatorName: string;
22
+ };
23
+ export declare function humanizeGuardrailParameterId(id: string): string;
24
+ export declare function enrichGuardrailDefinitions(definitions: readonly GuardrailDefinitionWire[], options?: EnrichGuardrailDefinitionsOptions): EnrichedGuardrailDefinition[];
25
+ export interface GuardrailFolderMetadata {
26
+ folderPath?: string;
27
+ folderKey?: string;
28
+ }
29
+ export declare function withGuardrailFolderMetadata<T extends EnrichedGuardrailDefinition>(definitions: readonly T[], resolve: (connectionId: string) => GuardrailFolderMetadata | undefined): T[];
30
+ //# sourceMappingURL=definitions-enrich.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions-enrich.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/definitions-enrich.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,uBAAuB,EAAoC,MAAM,oBAAoB,CAAC;AAcpG,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IAEtE,WAAW,EAAE,MAAM,CAAC;IAEpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iCAAiC;IAKhD,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAM1B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAGD,wBAAgB,wBAAwB,CAAC,CAAC,SAAS;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,EAC9E,UAAU,EAAE,CAAC,GACZ,UAAU,IAAI,CAAC,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAA;CAAE,CAEhD;AAOD,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CA4C/D;AA6ID,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,SAAS,uBAAuB,EAAE,EAC/C,OAAO,GAAE,iCAAsC,GAC9C,2BAA2B,EAAE,CAS/B;AAGD,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,2BAA2B,EAC/E,WAAW,EAAE,SAAS,CAAC,EAAE,EACzB,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,uBAAuB,GAAG,SAAS,GACrE,CAAC,EAAE,CAWL"}
@@ -0,0 +1,130 @@
1
+ import { GUARDRAIL_COPY_EN } from "./definitions-copy.js";
2
+ function isByoGuardrailDefinition(definition) {
3
+ return void 0 !== definition.byoValidatorName;
4
+ }
5
+ function humanizeGuardrailParameterId(id) {
6
+ const words = [];
7
+ let word = '';
8
+ let allCaps = true;
9
+ const flush = ()=>{
10
+ if ('' !== word) words.push(word);
11
+ word = '';
12
+ allCaps = true;
13
+ };
14
+ for (const char of id){
15
+ const isUpper = char >= 'A' && char <= 'Z';
16
+ const isWordChar = isUpper || char >= 'a' && char <= 'z' || char >= '0' && char <= '9';
17
+ if (isWordChar) if (isUpper) {
18
+ if (!allCaps) flush();
19
+ word += char;
20
+ } else {
21
+ if (allCaps && word.length > 1) {
22
+ const carried = word.slice(-1);
23
+ word = word.slice(0, -1);
24
+ flush();
25
+ word = carried;
26
+ }
27
+ allCaps = false;
28
+ word += char;
29
+ }
30
+ else flush();
31
+ }
32
+ flush();
33
+ if (0 === words.length) return id;
34
+ const spaced = words.map((entry)=>entry.length > 1 && entry === entry.toUpperCase() ? entry : entry.toLowerCase()).join(' ');
35
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1);
36
+ }
37
+ function ownCopyEntry(table, key, isValid) {
38
+ if (void 0 === table || !Object.hasOwn(table, key)) return;
39
+ const value = table[key];
40
+ return isValid(value) ? value : void 0;
41
+ }
42
+ const isCopyString = (value)=>'string' == typeof value;
43
+ const isCopyRecord = (value)=>'object' == typeof value && null !== value;
44
+ function toParameterDefinition(param, curated) {
45
+ const definition = {
46
+ id: param.id,
47
+ type: param.type,
48
+ label: param.displayName ?? ownCopyEntry(curated?.paramLabels, param.id, isCopyString) ?? humanizeGuardrailParameterId(param.id),
49
+ required: param.required,
50
+ defaultValue: param.defaultValue
51
+ };
52
+ const tooltip = param.description ?? ownCopyEntry(curated?.paramTooltips, param.id, isCopyString);
53
+ if (void 0 !== tooltip) definition.tooltip = tooltip;
54
+ const curatedOptionLabels = ownCopyEntry(curated?.optionLabels, param.id, isCopyRecord);
55
+ const wireOptionLabels = 'enum' === param.type || 'enum-list' === param.type ? param.optionLabels : void 0;
56
+ if (void 0 !== curatedOptionLabels || void 0 !== wireOptionLabels) definition.optionLabels = {
57
+ ...curatedOptionLabels,
58
+ ...wireOptionLabels
59
+ };
60
+ switch(param.type){
61
+ case 'enum':
62
+ case 'enum-list':
63
+ definition.options = param.options;
64
+ break;
65
+ case 'map-enum':
66
+ definition.keySource = param.keySource;
67
+ if (null != param.min) definition.min = param.min;
68
+ if (null != param.max) definition.max = param.max;
69
+ definition.step = param.step ?? 0.1;
70
+ break;
71
+ case 'number':
72
+ if (null != param.min) definition.min = param.min;
73
+ if (null != param.max) definition.max = param.max;
74
+ if (null != param.step) definition.step = param.step;
75
+ break;
76
+ case 'text':
77
+ if (null != param.maxLength) definition.maxLength = param.maxLength;
78
+ break;
79
+ case 'text-list':
80
+ if (null != param.maxLength) definition.maxLength = param.maxLength;
81
+ if (null != param.maxItems) definition.maxItems = param.maxItems;
82
+ break;
83
+ default:
84
+ break;
85
+ }
86
+ return definition;
87
+ }
88
+ function enrichOne(wire, copy) {
89
+ const isByo = isByoGuardrailDefinition(wire);
90
+ const curated = isByo || !Object.hasOwn(copy, wire.validator) ? void 0 : copy[wire.validator];
91
+ const enriched = {
92
+ validator: wire.validator,
93
+ displayName: (isByo ? wire.displayName : curated?.displayName ?? wire.displayName) ?? wire.validator,
94
+ description: (isByo ? wire.description : curated?.description ?? wire.description) ?? '',
95
+ allowedScopes: wire.allowedScopes,
96
+ parameters: wire.parameters.map((param)=>toParameterDefinition(param, curated)),
97
+ status: wire.status
98
+ };
99
+ if (curated?.usageNote !== void 0) enriched.usageNote = curated.usageNote;
100
+ if (void 0 !== wire.byoValidatorName) enriched.byoValidatorName = wire.byoValidatorName;
101
+ if (void 0 !== wire.byoConnectorName) enriched.byoConnectorName = wire.byoConnectorName;
102
+ if (void 0 !== wire.byoConnectorKey) enriched.byoConnectorKey = wire.byoConnectorKey;
103
+ if (void 0 !== wire.byoGuardrailConnectionId) enriched.byoGuardrailConnectionId = wire.byoGuardrailConnectionId;
104
+ if (void 0 !== wire.byoConfigurationId) enriched.byoConfigurationId = wire.byoConfigurationId;
105
+ if (void 0 !== wire.folderPath) enriched.folderPath = wire.folderPath;
106
+ if (void 0 !== wire.folderKey) enriched.folderKey = wire.folderKey;
107
+ return enriched;
108
+ }
109
+ function enrichGuardrailDefinitions(definitions, options = {}) {
110
+ const copy = options.copy ?? GUARDRAIL_COPY_EN;
111
+ const hidden = new Set(options.hiddenValidators ?? []);
112
+ const result = [];
113
+ for (const wire of definitions)if (!(!isByoGuardrailDefinition(wire) && hidden.has(wire.validator))) result.push(enrichOne(wire, copy));
114
+ return result;
115
+ }
116
+ function withGuardrailFolderMetadata(definitions, resolve) {
117
+ return definitions.map((definition)=>{
118
+ const connectionId = definition.byoGuardrailConnectionId;
119
+ if (void 0 === connectionId) return definition;
120
+ const metadata = resolve(connectionId);
121
+ if (void 0 === metadata) return definition;
122
+ const next = {
123
+ ...definition
124
+ };
125
+ if (void 0 !== metadata.folderPath) next.folderPath = metadata.folderPath;
126
+ if (void 0 !== metadata.folderKey) next.folderKey = metadata.folderKey;
127
+ return next;
128
+ });
129
+ }
130
+ export { enrichGuardrailDefinitions, humanizeGuardrailParameterId, isByoGuardrailDefinition, withGuardrailFolderMetadata };