@uipath/maestro-builder-sdk 6.68.4 → 6.68.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.
@@ -19,7 +19,7 @@ import { bindingLabelRefusal } from '../core/binding-messages.js';
19
19
  import { resolveEventWhere } from '../core/lookups.js';
20
20
  import { resolveCaseSubscription } from './subscription.js';
21
21
  import { dedupeConditionNames } from './rule-names.js';
22
- import { EXTERNAL_TASK_DESCRIPTOR_CONTRACT, EXTERNAL_TASK_HYBRID_UNSUPPORTED, externalDescriptorRefusal, externalHybridRefusal, externalServiceType, isExternalExecutionMode, } from './external.js';
22
+ import { EXTERNAL_TASK_DESCRIPTOR_CONTRACT, EXTERNAL_TASK_EVENT, externalDescriptorRefusal, externalEventRefusal, externalServiceType, isExternalExecutionMode, } from './external.js';
23
23
  import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS, caseVersionMismatch } from './format-profile.js';
24
24
  import { isResourceLabelRefusal, resolveResourceRef, resourceIdentity } from './resource-identity.js';
25
25
  import { ownEntry } from '../core/own-entry.js';
@@ -31,6 +31,7 @@ import { readEventFilterLeaf, eventFilterTreeLeaf } from '../core/event-filters.
31
31
  import { responseJsonSchema } from '../core/connector-response-schema.js';
32
32
  import { ruleShapeProblems } from './rule-options.js';
33
33
  import { CompileRefusal } from '../core/compile-refusal.js';
34
+ import { implicitInArgBuiltTrigger, unboundInArgMessage } from './in-arg-binding.js';
34
35
  import { taskShapeProblems } from './task-shape.js';
35
36
  import { connectorPlaceholderData, isConnectorPlaceholder } from './connector-placeholder.js';
36
37
  /** The ids a serialize pass hashed from element ids, by the document it returned. */
@@ -258,7 +259,7 @@ export function serialize(built, opts = {}) {
258
259
  // outputs bound (collected during stage emission above). A declared var wins
259
260
  // on a name clash. An own-name output (`id == var`) writes no root entry: like
260
261
  // the Designer, the output row is itself the variable `=vars.<id>` reads.
261
- const variables = emitVariables(built.vars, ids, triggerNodeByRef);
262
+ const variables = emitVariables(built.vars, ids, triggerNodeByRef, triggerNodes, built.triggers);
262
263
  const inputOutputs = variables.inputOutputs;
263
264
  const declared = new Set(inputOutputs.map((e) => e.id));
264
265
  for (const [name, companion] of resolver.varCompanions)
@@ -960,7 +961,8 @@ function reseed(value, ids) {
960
961
  value[key] = next;
961
962
  }
962
963
  }
963
- function emitVariables(vars, ids, triggerNodeByRef) {
964
+ function emitVariables(vars, ids, triggerNodeByRef, triggerNodes, triggers) {
965
+ const implicit = implicitInArgBuiltTrigger(triggers);
964
966
  const inputs = [];
965
967
  const outputs = [];
966
968
  const inputOutputs = [];
@@ -1002,26 +1004,38 @@ function emitVariables(vars, ids, triggerNodeByRef) {
1002
1004
  id: slotId,
1003
1005
  name: vd.name,
1004
1006
  type: vd.type,
1005
- ...encodedDefault(vd),
1007
+ // A trigger-bound In-arg always carries a default, `""` when none was
1008
+ // authored. It is written here, ahead of a structured var's schema, so
1009
+ // `{ type }` and `{ type, default: "" }` emit the same bytes and a
1010
+ // decompile (which reads the `""` back) recompiles byte-identically.
1011
+ ...(vd.direction === 'in' ? { default: encodedDefault(vd).default ?? '' } : encodedDefault(vd)),
1012
+ ...jsonSchemaFields(vd),
1006
1013
  };
1007
- Object.assign(entry, jsonSchemaFields(vd));
1008
- if (vd.direction === 'in' && vd.sourceTrigger) {
1009
- // Trigger-bound In-arg: formal slot + companion + a bridge on the trigger
1010
- // node that copies the slot into the companion at fire (see the skill's
1011
- // variables/io-binding + global-vars § In argument). Its companion is keyed
1012
- // to the trigger node, so it does not also take a root companion.
1013
- const node = triggerNodeByRef.get(vd.sourceTrigger);
1014
- if (!node)
1015
- throw new CompileRefusal('CASE_IN_ARG_TRIGGER_NOT_ADDED', `In-arg "${vd.name}" is bound via { from } to a trigger that was not added with .trigger(...).`);
1016
- entry.default = vd.default === undefined ? '' : encodedDefault(vd).default;
1014
+ if (vd.direction === 'in') {
1015
+ // An In-arg is always trigger-bound: formal slot + companion + a bridge on
1016
+ // the trigger node that copies the slot into the companion at fire (see the
1017
+ // skill's variables/io-binding + global-vars § In argument). Its companion
1018
+ // is keyed to the trigger node, so it does not also take a root companion.
1019
+ // The Designer writes no other In-arg shape, and `uip maestro case validate
1020
+ // --strict` refuses an In-arg without its companion
1021
+ // (STRICT_INPUTOUTPUTS_COMPANION). Without `{ from }` the arg binds to the
1022
+ // primary trigger (in-arg-binding.ts); when there is none it is refused
1023
+ // (`check` reports the same code first).
1024
+ let node;
1025
+ if (vd.sourceTrigger) {
1026
+ node = triggerNodeByRef.get(vd.sourceTrigger);
1027
+ if (!node)
1028
+ throw new CompileRefusal('CASE_IN_ARG_TRIGGER_NOT_ADDED', `In-arg "${vd.name}" is bound via { from } to a trigger that was not added with .trigger(...).`);
1029
+ }
1030
+ else if (implicit !== undefined)
1031
+ node = triggerNodes[implicit];
1032
+ else
1033
+ throw new CompileRefusal('CASE_IN_ARG_UNBOUND', unboundInArgMessage(vd.name, triggers));
1017
1034
  entry.elementId = node.id;
1018
1035
  inputs.push(entry);
1019
1036
  inputOutputs.push({ id: vd.name, name: vd.name, type: vd.type, elementId: node.id, ...jsonSchemaFields(vd) });
1020
1037
  appendTriggerBridge(node, { name: vd.name, type: vd.type, source: `=vars.${slotId}`, var: vd.name });
1021
1038
  }
1022
- else if (vd.direction === 'in') {
1023
- inputs.push(entry); // bare declaration (unbound In-arg; readable only via a trigger)
1024
- }
1025
1039
  else if (vd.direction === 'out') {
1026
1040
  outputs.push(entry); // formal declaration
1027
1041
  inputOutputs.push(readableCompanion(vd)); // …made readable as `vars.<name>`
@@ -1739,7 +1753,7 @@ function businessRuleTaskData(task, resolver, elementId, ids) {
1739
1753
  * the op's output schema. Connection/folder resolve through `bindings` and are
1740
1754
  * referenced as `=bindings.<id>`, with the binding entry collected at case root.
1741
1755
  */
1742
- function connectorTaskData(spec, resolver, elementId, where, executionType) {
1756
+ function connectorTaskData(spec, resolver, elementId, where, executionType, event) {
1743
1757
  if (!resolver.library)
1744
1758
  throw new CompileRefusal('LIBRARY_REQUIRED', `connector task needs the connector library — pass { library } to serialize or use uip maestro case compile --library.`);
1745
1759
  const rc = resolver.library.resolve(spec.key, spec.action, spec.version, spec.object);
@@ -1787,7 +1801,7 @@ function connectorTaskData(spec, resolver, elementId, where, executionType) {
1787
1801
  // from the `body` slot. This used to drop the whole wire and push a filled
1788
1802
  // file part into the body, where the runtime does not look for it (#1420).
1789
1803
  const fileParts = (slots.multipartParameters ?? []).filter((part) => part.dataType.toLowerCase() === 'file');
1790
- context.push(io('metadata', 'json', { body: connectorMetadata(rc, op, slots, elementId, executionType) }));
1804
+ context.push(io('metadata', 'json', { body: connectorMetadata(rc, op, slots, elementId, executionType, event) }));
1791
1805
  const inputs = [
1792
1806
  ioSlot('pathParameters', pathParameters, `${elementId}`),
1793
1807
  ioSlot('queryParameters', queryParameters, `${elementId}`),
@@ -1816,14 +1830,20 @@ function externalTaskData(kind, spec, resolver, elementId, where) {
1816
1830
  throw new CompileRefusal(EXTERNAL_TASK_DESCRIPTOR_CONTRACT, refused);
1817
1831
  if (!isExternalExecutionMode(spec.mode))
1818
1832
  throw new CompileRefusal('EXTERNAL_TASK_MODE', `${kind} task mode must be the connector object's executionType: "sync", "async" or "hybrid".`);
1819
- if (spec.mode === 'hybrid')
1820
- throw new CompileRefusal(EXTERNAL_TASK_HYBRID_UNSUPPORTED, externalHybridRefusal(where));
1833
+ const eventRefused = externalEventRefusal(where, spec.mode, spec.event);
1834
+ if (eventRefused)
1835
+ throw new CompileRefusal(EXTERNAL_TASK_EVENT, eventRefused);
1821
1836
  if (!spec.connector.connection || !spec.connector.folder)
1822
1837
  throw new CompileRefusal(spec.connector.connection ? 'EXTERNAL_TASK_FOLDER' : 'EXTERNAL_TASK_CONNECTION', `${kind} task requires non-empty connection and folder binding names.`);
1823
- const data = connectorTaskData(spec.connector, resolver, elementId, where, spec.mode);
1838
+ const data = connectorTaskData(spec.connector, resolver, elementId, where, spec.mode, spec.event);
1824
1839
  const context = data.context;
1825
1840
  const metadataAt = context.findIndex((row) => row.name === 'metadata');
1826
- context.splice(metadataAt, 0, io('executionType', 'string', { value: spec.mode }));
1841
+ // The Designer's order: the event pair (when the object answers through one),
1842
+ // then the execution type, just before `metadata`.
1843
+ context.splice(metadataAt, 0, ...(spec.event ? [
1844
+ io('operation', 'string', { value: spec.event.operation }),
1845
+ io('eventMode', 'string', { value: spec.event.mode }),
1846
+ ] : []), io('executionType', 'string', { value: spec.mode }));
1827
1847
  context.push(io('activityConfigurationVersion', 'string', { value: 'v2' }));
1828
1848
  return { ...data, serviceType: externalServiceType(kind, spec.mode) };
1829
1849
  }
@@ -1957,7 +1977,7 @@ function folderBindingRef(resolver, name, connection, site) {
1957
1977
  * Generic activity, and the library version where the platform writes
1958
1978
  * `packageVersion: "1.0.0"` (#1420).
1959
1979
  */
1960
- function connectorMetadata(rc, op, slots, seed, executionType) {
1980
+ function connectorMetadata(rc, op, slots, seed, executionType, event) {
1961
1981
  // The part DECLARATIONS only: a file part's value rides on its `file` input.
1962
1982
  const multipartParameters = (slots.multipartParameters ?? []).map(({ name, dataType }) => ({ name, dataType }));
1963
1983
  // The configuration replays the authored values (a schema action's parent
@@ -1973,6 +1993,9 @@ function connectorMetadata(rc, op, slots, seed, executionType) {
1973
1993
  uiPathActivityTypeId: rc.activityTypeId ?? '',
1974
1994
  errorState: { issues: [] },
1975
1995
  ...(executionType ? { executionType } : {}),
1996
+ // The event an async / hybrid object answers with, named as the Designer
1997
+ // names it here (`eventType`, where the context row is `operation`).
1998
+ ...(event ? { eventType: event.operation, eventMode: event.mode } : {}),
1976
1999
  },
1977
2000
  activityMetadata: {
1978
2001
  activity: {
@@ -151,6 +151,7 @@ export declare const REFUSALS: {
151
151
  readonly CASE_APP_DETAILS_TYPE: "lint";
152
152
  readonly CASE_EXPORT_NOT_BUILT: "lowering";
153
153
  readonly CASE_IN_ARG_TRIGGER_NOT_ADDED: "lowering";
154
+ readonly CASE_IN_ARG_UNBOUND: "lowering";
154
155
  readonly CASE_LAYOUT_NODE_MATCH: "lowering";
155
156
  readonly CASE_LAYOUT_UNKNOWN_FIELD: "lowering";
156
157
  readonly CASE_NO_DEFAULT_EXPORT: "lowering";
@@ -274,8 +275,8 @@ export declare const REFUSALS: {
274
275
  readonly EXTERNAL_TASK_DESCRIPTOR: "lint";
275
276
  readonly EXTERNAL_TASK_DESCRIPTOR_CONTRACT: "lowering";
276
277
  readonly EXTERNAL_TASK_EMPTY_DATA: "lint";
278
+ readonly EXTERNAL_TASK_EVENT: "lowering";
277
279
  readonly EXTERNAL_TASK_FOLDER: "lowering";
278
- readonly EXTERNAL_TASK_HYBRID_UNSUPPORTED: "lowering";
279
280
  readonly EXTERNAL_TASK_MODE: "lowering";
280
281
  readonly EXTRACT_SCHEMA_SHAPE: "lint";
281
282
  readonly FAKE_JOIN: "lint";
@@ -199,6 +199,7 @@ export const REFUSALS = {
199
199
  CASE_APP_DETAILS_TYPE: 'lint',
200
200
  CASE_EXPORT_NOT_BUILT: 'lowering',
201
201
  CASE_IN_ARG_TRIGGER_NOT_ADDED: 'lowering',
202
+ CASE_IN_ARG_UNBOUND: 'lowering',
202
203
  CASE_LAYOUT_NODE_MATCH: 'lowering',
203
204
  CASE_LAYOUT_UNKNOWN_FIELD: 'lowering',
204
205
  CASE_NO_DEFAULT_EXPORT: 'lowering',
@@ -325,8 +326,8 @@ export const REFUSALS = {
325
326
  EXTERNAL_TASK_DESCRIPTOR: 'lint',
326
327
  EXTERNAL_TASK_DESCRIPTOR_CONTRACT: 'lowering',
327
328
  EXTERNAL_TASK_EMPTY_DATA: 'lint',
329
+ EXTERNAL_TASK_EVENT: 'lowering',
328
330
  EXTERNAL_TASK_FOLDER: 'lowering',
329
- EXTERNAL_TASK_HYBRID_UNSUPPORTED: 'lowering',
330
331
  EXTERNAL_TASK_MODE: 'lowering',
331
332
  EXTRACT_SCHEMA_SHAPE: 'lint',
332
333
  FAKE_JOIN: 'lint',
package/dist/index.d.ts CHANGED
@@ -21,7 +21,7 @@ export { Bindings } from './bindings.js';
21
21
  export { check } from './check.js';
22
22
  export type { Diagnostic } from './check.js';
23
23
  export { casePlan, preserveCaseJson, rule, when } from './case/case-sdk.js';
24
- export type { CaseRule, CaseRuleInput, CaseRuleGrid, WhenExpression, CaseJsonPreservation, CaseLayout, CaseNodeLayout, PreservedCaseNode, PreservedTaskFields, PreservedVariableLane, CaseRuleType, RuleOpts, BuiltCase, BuiltStage, BuiltTask, TaskKind, UnresolvedReferenceTaskKind, ExternalExecutionMode, ExternalTaskOptions, } from './case/case-sdk.js';
24
+ export type { CaseRule, CaseRuleInput, CaseRuleGrid, WhenExpression, CaseJsonPreservation, CaseLayout, CaseNodeLayout, PreservedCaseNode, PreservedTaskFields, PreservedVariableLane, CaseRuleType, RuleOpts, BuiltCase, BuiltStage, BuiltTask, TaskKind, UnresolvedReferenceTaskKind, ExternalEventPair, ExternalExecutionMode, ExternalTaskOptions, } from './case/case-sdk.js';
25
25
  export { serialize as serializeCase } from './case/serialize.js';
26
26
  export { decompile as decompileCase, decompileWithDiagnostics as decompileCaseWithDiagnostics } from './case/decompile.js';
27
27
  export { bpmn } from './bpmn/bpmn-sdk.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.68.4",
3
+ "version": "6.68.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",
@@ -100,5 +100,5 @@
100
100
  "@types/node": "^22.7.0",
101
101
  "esbuild": "^0.28.1"
102
102
  },
103
- "gitref": "f879560df189ceab42f899123d36f0add5b0a562"
103
+ "gitref": "7e50034dc8a8317fe205d355859bc80f047174b3"
104
104
  }