@uipath/maestro-builder-sdk 6.82.5 → 6.82.6

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.
@@ -35,6 +35,7 @@ import { eventFiltersNotArray, readEventFilter, readEventFilterLeaf, eventFilter
35
35
  import { responseJsonSchema } from '../core/connector-response-schema.js';
36
36
  import { ruleShapeProblems } from './rule-options.js';
37
37
  import { CompileRefusal } from '../core/compile-refusal.js';
38
+ import { expressionBindingId } from '../core/expression-binding-id.js';
38
39
  import { implicitInArgBuiltTrigger, unboundInArgMessage } from './in-arg-binding.js';
39
40
  import { jsonClone } from '../core/json-clone.js';
40
41
  import { savedDocumentExtractionData } from './document-extraction-saved.js';
@@ -3073,9 +3074,17 @@ function bindingRef(resolver, name, resource, propertyAttribute, displayName, si
3073
3074
  warnStub(resolver, name, site, (entry?.resourceKey ?? entry?.default));
3074
3075
  // Only a label with no bindings.json entry gets a minted id: an entry's
3075
3076
  // `resourceKey` is the real key, so its id (or its name) cannot clash with it.
3076
- const id = entry
3077
- ? String(entry.id ?? name)
3077
+ // An entry's id is the author's label, so it is made readable as an expression
3078
+ // first: `=bindings.is-sandboxes` faults at run time (`entryBindingId`).
3079
+ const baseId = entry
3080
+ ? entryBindingId(resolver, entry, name)
3078
3081
  : offlineBindingId(resolver, offlineBindingSeed(resource, propertyAttribute, name));
3082
+ const value = entry?.default ?? resourceKey;
3083
+ // Two labels can rewrite to one id (`a-b`, `a_b`): the second gets `_2`, never
3084
+ // the first one's row.
3085
+ let id = baseId;
3086
+ for (let n = 2; bindsOther(resolver.bindingSink.get(id), resource, propertyAttribute, resourceKey, value); n++)
3087
+ id = `${baseId}_${n}`;
3079
3088
  if (!resolver.bindingSink.has(id)) {
3080
3089
  resolver.bindingSink.set(id, {
3081
3090
  id,
@@ -3083,12 +3092,41 @@ function bindingRef(resolver, name, resource, propertyAttribute, displayName, si
3083
3092
  type: 'string',
3084
3093
  resource,
3085
3094
  resourceKey,
3086
- default: entry?.default ?? resourceKey,
3095
+ default: value,
3087
3096
  propertyAttribute,
3088
3097
  });
3089
3098
  }
3090
3099
  return { id, resourceKey };
3091
3100
  }
3101
+ /**
3102
+ * The root binding id for a bindings.json entry: its id (or label), made
3103
+ * readable through `=bindings.<id>` (`expressionBindingId`). A rewritten id must
3104
+ * not be a label bindings.json itself declares for another entry: decompile
3105
+ * writes the id back as the connector's label, and the recompile would resolve
3106
+ * it to that other entry. With `is-sandboxes` and `is_sandboxes` both declared,
3107
+ * `is-sandboxes` gets `is_sandboxes_2`, so `is_sandboxes` keeps its own name and
3108
+ * `is_sandboxes_2` resolves through the plan's own row.
3109
+ */
3110
+ function entryBindingId(resolver, entry, name) {
3111
+ const raw = String(entry.id ?? name);
3112
+ const base = expressionBindingId(raw);
3113
+ if (base === raw)
3114
+ return base;
3115
+ const shadows = (id) => {
3116
+ const other = resolver.bindings?.entry?.(id);
3117
+ return other !== undefined && other !== entry && !resolver.bindings?.fromFallback?.(id);
3118
+ };
3119
+ let id = base;
3120
+ for (let n = 2; shadows(id); n++)
3121
+ id = `${base}_${n}`;
3122
+ return id;
3123
+ }
3124
+ /** True when `row` exists and binds something other than the given resource
3125
+ * property (resource, attribute, key or value differ). */
3126
+ function bindsOther(row, resource, propertyAttribute, resourceKey, value) {
3127
+ return row !== undefined && (row.resource !== resource || row.propertyAttribute !== propertyAttribute
3128
+ || row.resourceKey !== resourceKey || row.default !== value);
3129
+ }
3092
3130
  /**
3093
3131
  * A connector's folder is a property of its connection:
3094
3132
  * { resourceKey: <connection key>, default: <folder key>, propertyAttribute: 'folderKey' }.
@@ -3108,7 +3146,7 @@ function folderBindingRef(resolver, name, connection, site) {
3108
3146
  throw refused;
3109
3147
  const entry = resolver.bindings?.entry?.(name);
3110
3148
  const baseId = entry
3111
- ? String(entry.id ?? name)
3149
+ ? entryBindingId(resolver, entry, name)
3112
3150
  : offlineBindingId(resolver, offlineBindingSeed('Connection', 'folderKey', name, connection.resourceKey));
3113
3151
  const folderKey = entry?.default ?? entry?.resourceKey ?? name;
3114
3152
  warnStub(resolver, name, site, (entry?.default ?? entry?.resourceKey));
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A binding id the runtime can read back through `=bindings.<id>`.
3
+ *
4
+ * A connector's `connection` / `folderKey` context value is the EXPRESSION
5
+ * `=bindings.<id>`, and the Maestro engine evaluates it with DynamicExpresso,
6
+ * a C# expression parser. It splits a hyphenated id at the hyphen:
7
+ * `bindings.is-sandboxes` is read as `bindings.is - sandboxes`, `sandboxes` is an
8
+ * unknown identifier, evaluation fails, and the task keeps the literal string
9
+ * `=bindings.is-sandboxes` where it needs a connection GUID. `validate` accepts
10
+ * the plan; only the run faults.
11
+ *
12
+ * A bindings.json label is free text (`uip maestro registry prepare
13
+ * --bind-connection is-sandboxes` writes `id: "is-sandboxes"`, the tenant's
14
+ * connection name), and Case compile used to copy it into the root binding id
15
+ * as written. Studio Web never hits this: it mints `b` + alphanumerics.
16
+ *
17
+ * So an id that is not a C# identifier is rewritten: every character outside
18
+ * `[A-Za-z0-9_]` becomes `_`, and a leading digit gets a `_` prefix.
19
+ * `is-sandboxes` → `is_sandboxes`, `my.conn` → `my_conn`, `1drive` → `_1drive`.
20
+ * An id that already is one (`bOC1`, `slack`, `solution_folder`) is unchanged,
21
+ * and so is a C# keyword (`default`, `new`): after `bindings.` the engine reads it
22
+ * as a member name (measured under DynamicExpresso 2.18.0, the engine's pin).
23
+ * The binding's `name` keeps the label, so Studio Web and bindings_v2.json still
24
+ * show it.
25
+ */
26
+ export declare function expressionBindingId(id: string): string;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * A binding id the runtime can read back through `=bindings.<id>`.
3
+ *
4
+ * A connector's `connection` / `folderKey` context value is the EXPRESSION
5
+ * `=bindings.<id>`, and the Maestro engine evaluates it with DynamicExpresso,
6
+ * a C# expression parser. It splits a hyphenated id at the hyphen:
7
+ * `bindings.is-sandboxes` is read as `bindings.is - sandboxes`, `sandboxes` is an
8
+ * unknown identifier, evaluation fails, and the task keeps the literal string
9
+ * `=bindings.is-sandboxes` where it needs a connection GUID. `validate` accepts
10
+ * the plan; only the run faults.
11
+ *
12
+ * A bindings.json label is free text (`uip maestro registry prepare
13
+ * --bind-connection is-sandboxes` writes `id: "is-sandboxes"`, the tenant's
14
+ * connection name), and Case compile used to copy it into the root binding id
15
+ * as written. Studio Web never hits this: it mints `b` + alphanumerics.
16
+ *
17
+ * So an id that is not a C# identifier is rewritten: every character outside
18
+ * `[A-Za-z0-9_]` becomes `_`, and a leading digit gets a `_` prefix.
19
+ * `is-sandboxes` → `is_sandboxes`, `my.conn` → `my_conn`, `1drive` → `_1drive`.
20
+ * An id that already is one (`bOC1`, `slack`, `solution_folder`) is unchanged,
21
+ * and so is a C# keyword (`default`, `new`): after `bindings.` the engine reads it
22
+ * as a member name (measured under DynamicExpresso 2.18.0, the engine's pin).
23
+ * The binding's `name` keeps the label, so Studio Web and bindings_v2.json still
24
+ * show it.
25
+ */
26
+ export function expressionBindingId(id) {
27
+ if (EXPRESSION_IDENTIFIER.test(id))
28
+ return id;
29
+ const safe = id.replace(/[^A-Za-z0-9_]/g, '_');
30
+ return /^[A-Za-z_]/.test(safe) ? safe : `_${safe}`;
31
+ }
32
+ /** A C#/DynamicExpresso identifier: what one `bindings.<id>` member access can name. */
33
+ const EXPRESSION_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.82.5",
3
+ "version": "6.82.6",
4
4
  "description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.uipath.com/maestro",
@@ -103,5 +103,5 @@
103
103
  "@types/node": "^22.7.0",
104
104
  "esbuild": "^0.28.1"
105
105
  },
106
- "gitref": "4c46616520ed5bfb1bea108f4d4c5da60145e40f"
106
+ "gitref": "3d6248ed3d0e27d5b8a62528bf15d0ba808d06e7"
107
107
  }