@uipath/maestro-builder-sdk 6.96.0 → 6.96.2

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.
@@ -1,5 +1,6 @@
1
1
  import { BindingRefusal, bindingMissingMessage, missingBindingLabels } from '../../../core/binding-messages.js';
2
- import { prepareCommand } from '../../../core/cli-spelling.js';
2
+ import { PULL_COMMAND, prepareCommand } from '../../../core/cli-spelling.js';
3
+ import { carriedConnector, carriedDefinitionMismatch, carriedOperationOf, carriedOperationRefusal, } from '../../../core/carried-connector-operation.js';
3
4
  import { buildConfiguration, readConfigurationIdentity } from '../../../core/connector-configuration.js';
4
5
  import { CONNECTOR_INPUT_MISSING, FLOW_EXPR_DIALECT, buildConnectorInputs, replayInputsOf, transportHttpMethod } from '../../../core/connector-inputs.js';
5
6
  import { ConnectorResolveError } from '../../../core/connector-resolve-error.js';
@@ -63,6 +64,50 @@ function listOutputs(rc, nodeId) {
63
64
  return undefined;
64
65
  return { output: { ...subNodeId(jsonClone(out), nodeId), type: 'array' } };
65
66
  }
67
+ /**
68
+ * The operation a step carries for a node type the library has no entry for,
69
+ * or `undefined` when it carries none: the step's `carried` transport and fields
70
+ * with the definition the flow carries for `<nodeType>@<version>` in
71
+ * `.definitions([...])`. Both halves, or nothing: either alone does not describe
72
+ * an operation, and the step stays CONNECTOR_NOT_IN_LIBRARY.
73
+ */
74
+ function carriedResolution(spec, ctx) {
75
+ const version = spec.version ?? ctx.pinnedVersion;
76
+ if (spec.carried === undefined || version === undefined)
77
+ return undefined;
78
+ const nodeType = `${CONNECTOR_PREFIX}${spec.key}.${spec.action}`;
79
+ const definition = ctx.definition(nodeType, version);
80
+ if (!definition || typeof definition !== 'object')
81
+ return undefined;
82
+ const mismatch = carriedDefinitionMismatch(definition, spec.key, spec.carried, `Connector step "${ctx.step}"`);
83
+ if (mismatch)
84
+ throw new CompileRefusal('CARRIED_DEFINITION_INVALID', mismatch);
85
+ return carriedConnector(nodeType, spec.key, version, definition, spec.carried);
86
+ }
87
+ /**
88
+ * The library's answer for the step's operation: the entry, or what
89
+ * `library.resolve` threw. Only the library call is caught here, so a refusal of
90
+ * the step's carried operation ({@link carriedResolution}), which runs after a
91
+ * CONNECTOR_NOT_IN_LIBRARY answer, reaches the author with its own code.
92
+ */
93
+ function libraryResolution(spec, library) {
94
+ try {
95
+ return { rc: library.resolve(spec.key, spec.action, spec.version, spec.object) };
96
+ }
97
+ catch (error) {
98
+ return { error };
99
+ }
100
+ }
101
+ /**
102
+ * What to do about an input a carried operation does not name: the file
103
+ * describes only the inputs its node sets, so another one needs the operation
104
+ * in the library.
105
+ */
106
+ function carriedInputHint(spec) {
107
+ return ' This operation is not in the connector library: the step compiles from the .flow file\'s own description '
108
+ + '(its `carried` option and carried definition), which names only the inputs the saved node sets. To use another input, '
109
+ + `refresh the library (\`${PULL_COMMAND}\`) or prepare the operation (\`${prepareCommand(spec.key, spec.action)}\`).`;
110
+ }
66
111
  function serializeConnector(spec, ctx) {
67
112
  const step = ctx.step;
68
113
  if (!ctx.library) {
@@ -83,11 +128,29 @@ function serializeConnector(spec, ctx) {
83
128
  // The library's refusals (the operation, its fields) name the connector, not
84
129
  // the step: they say which step as `check` always has.
85
130
  const onStep = (refusal) => new CompileRefusal(refusal.code, `Connector step "${step}": ${refusal.message}`, refusal.suggestion);
131
+ const carriedRefusal = carriedOperationRefusal(spec.carried, `Connector step "${step}"`);
132
+ if (carriedRefusal)
133
+ throw new CompileRefusal('CARRIED_DEFINITION_INVALID', carriedRefusal);
134
+ // The library's entry, else, when the library has no entry for the node type,
135
+ // the operation the step carries from the file (carriedResolution). Only on
136
+ // that refusal: an operation the library knows is the library's, whatever the
137
+ // source carries, so a carried copy cannot relax it. A refusal of the carried
138
+ // operation itself (CARRIED_DEFINITION_INVALID) is thrown as it is.
139
+ const resolved = libraryResolution(spec, ctx.library);
140
+ const fallback = 'error' in resolved && resolved.error instanceof ConnectorResolveError
141
+ && resolved.error.code === 'CONNECTOR_NOT_IN_LIBRARY'
142
+ ? carriedResolution(spec, ctx)
143
+ : undefined;
144
+ const carried = fallback !== undefined;
86
145
  let rc;
87
- try {
88
- rc = ctx.library.resolve(spec.key, spec.action, spec.version, spec.object);
146
+ if ('rc' in resolved) {
147
+ rc = resolved.rc;
89
148
  }
90
- catch (error) {
149
+ else if (fallback !== undefined) {
150
+ rc = fallback;
151
+ }
152
+ else {
153
+ const { error } = resolved;
91
154
  if (error instanceof Error && error.message.startsWith('internal SDK error:'))
92
155
  throw error;
93
156
  // A throw `library.resolve` makes on no purpose is still this step's refusal,
@@ -169,7 +232,12 @@ function serializeConnector(spec, ctx) {
169
232
  });
170
233
  }
171
234
  catch (error) {
172
- throw error instanceof CompileRefusal ? onStep(error) : error;
235
+ if (!(error instanceof CompileRefusal))
236
+ throw error;
237
+ const refusal = carried && error.code === 'CONNECTOR_INPUT'
238
+ ? new CompileRefusal(error.code, error.message + carriedInputHint(spec), error.suggestion)
239
+ : error;
240
+ throw onStep(refusal);
173
241
  }
174
242
  })();
175
243
  const replayInputs = replayInputsOf(connectorInputs);
@@ -279,6 +347,9 @@ function liftConnector(node, ctx) {
279
347
  kind: 'connector', ...split, inputs, connection, folder,
280
348
  object: liftedObject(detail),
281
349
  missing,
350
+ // Only for an operation the decompile's library lacks, beside the
351
+ // definition decompile carries for it: the two together describe it.
352
+ carried: ctx.carriesOperation() ? carriedOperationOf(detail) : undefined,
282
353
  };
283
354
  }
284
355
  /**
@@ -328,6 +399,7 @@ function printConnector(l, ctx) {
328
399
  connection: optional(l.connection),
329
400
  folder: optional(l.folder),
330
401
  object: optional(l.object),
402
+ carried: l.carried === undefined ? undefined : ctx.value(l.carried),
331
403
  };
332
404
  return {
333
405
  factory: 'connector',
@@ -353,6 +425,15 @@ const connector10 = {
353
425
  serialize: (spec, ctx) => serializeConnector(spec, ctx),
354
426
  deserialize: (node, ctx) => liftConnector(node, ctx),
355
427
  isDraft: (node, definition) => isConnectorDraft(node, definition),
428
+ // An operation the decompile's library has no entry for is carried from the
429
+ // file, when its saved detail describes one compile can rebuild.
430
+ carriesFromFile: (node, library) => {
431
+ const n = node;
432
+ if (typeof n.type !== 'string' || splitOperation(n.type) === undefined || library.indexes(n.type))
433
+ return false;
434
+ const detail = n.inputs?.detail;
435
+ return !!detail && typeof detail === 'object' && carriedOperationOf(detail) !== undefined;
436
+ },
356
437
  print: (spec, ctx) => printConnector(spec, ctx),
357
438
  check: (spec, ctx) => ctx.connector(spec),
358
439
  // Every Expr in the inputs, nested ones included, resolves against the flow's names.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.96.0",
3
+ "version": "6.96.2",
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",
@@ -113,5 +113,5 @@
113
113
  "@types/node": "^22.7.0",
114
114
  "esbuild": "^0.28.1"
115
115
  },
116
- "gitref": "4ab5fdcad1df35a5da9707a80b571ca2c336e8be"
116
+ "gitref": "2bea7fdf0185f37dfc88632250b4b5233480ecb2"
117
117
  }