@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.
@@ -627,6 +627,26 @@ export interface ExtensionPayload {
627
627
  type: string;
628
628
  /** `uipath:output` rows, emitted exactly as given — see {@link TypedOutputRow}. */
629
629
  outputRows: TypedOutputRow[];
630
+ /**
631
+ * The payload's own tag — `'uipath:activity'`, `'uipath:event'` or `'uipath:mapping'` —
632
+ * for a `type` the registry snapshot does not list.
633
+ *
634
+ * A decoration needs nothing from the registry but its tag, and a brownfield file
635
+ * already says which tag it used. Decompile writes this for an unlisted type, such
636
+ * as a case trigger's `None` (`{ type: 'None', tag: 'uipath:activity', outputRows }`),
637
+ * so the recompile writes the same element without a registry entry. Ignored for a
638
+ * type the snapshot lists: the snapshot's tag wins. Without it an unlisted type still
639
+ * refuses with `BPMN_TYPE_UNKNOWN`.
640
+ *
641
+ * With `tag` set, the `type` NAME is not checked against anything: a misspelled type
642
+ * compiles, and the platform only warns about it. That is the point for a type the
643
+ * file already carries, and a trap for a new node, so `check` warns
644
+ * (`PAYLOAD_TYPE_NOT_CHECKED`) on every payload that relies on it, naming the type.
645
+ * Do not copy `tag` from decompiled source onto a node you author.
646
+ */
647
+ tag?: 'uipath:activity' | 'uipath:event' | 'uipath:mapping';
648
+ /** The `uipath:type` `version` attribute, when it is not `v1` — see `ActivityNodeOpts.typeVersion`. */
649
+ typeVersion?: string;
630
650
  }
631
651
  /**
632
652
  * Options for `.startEvent()`. At most one of `message` / `timer` picks the
@@ -22,7 +22,7 @@ import { refreshConnectionDiagnostics } from './refresh-connections.js';
22
22
  import { KNOWN_METHOD_SET } from './known-methods.js';
23
23
  import { EQUALS_EXPR_DIALECT, checkConnectorLookups, checkConnectorResources, checkConnectorSchema, } from '../core/connector-checks.js';
24
24
  import { checkEventResolution, checkEventSubscription, eventParamsFor, } from '../core/event-checks.js';
25
- import { bindingRequiredFields, CASE_RUNTIME_INTERNAL_TYPES, CONNECTOR_ACTIVITY_TYPES, missingRequiredContext, missingRequiredInputs, platformEnforcesRequired, REGISTRY_GAPS, registryType, } from './typed-node.js';
25
+ import { bindingRequiredFields, CASE_RUNTIME_INTERNAL_TYPES, CONNECTOR_ACTIVITY_TYPES, missingRequiredContext, missingRequiredInputs, platformEnforcesRequired, isSnapshotType, REGISTRY_GAPS, registryType, } from './typed-node.js';
26
26
  import { ownEntry } from '../core/own-entry.js';
27
27
  import { MANAGED_HTTP_TYPE, isManagedHttpV2, managedHttpAbsoluteUrl, managedHttpMissing } from './managed-http.js';
28
28
  import { connectorV2Missing, isConnectorV2 } from './connector.js';
@@ -129,6 +129,7 @@ export function check(built, opts = {}) {
129
129
  checkConnectorRows(built, diags);
130
130
  checkConnectors(built, opts, diags);
131
131
  checkConnectorEvents(built, opts, diags);
132
+ checkCarriedPayloadTags(built, diags);
132
133
  // A `.dataService()` entity's recorded row is the serializer's (`lowerDataServiceEntity`).
133
134
  const { refusals, definitions, stoodIn } = serializerRefusals(built, opts, diags);
134
135
  diags.push(...refusals);
@@ -1950,6 +1951,30 @@ inEventSubProcess = false) {
1950
1951
  checkScope(n.nodes, n.flows, `subProcess "${n.id}"`, diags, false, n.triggeredByEvent === true);
1951
1952
  }
1952
1953
  }
1954
+ /**
1955
+ * A decoration payload that names a type the snapshot does not list and carries its own
1956
+ * `tag` (`ExtensionPayload.tag`). Compile then writes it without checking the type name,
1957
+ * so a typo (`Orchestrator.QueueItemAded`) compiles and the platform only warns. A
1958
+ * warning, not an error: decompile writes exactly this for a brownfield type such as a
1959
+ * case trigger's `None`, and that file must keep compiling. The warning makes the
1960
+ * unchecked name visible, so a copied pattern does not hide a typo.
1961
+ */
1962
+ function checkCarriedPayloadTags(built, diags) {
1963
+ for (const n of allNodes(built.nodes)) {
1964
+ const payload = n.payload;
1965
+ if (!payload?.type || payload.tag === undefined || isSnapshotType(payload.type))
1966
+ continue;
1967
+ diags.push({
1968
+ level: 'warning',
1969
+ code: 'PAYLOAD_TYPE_NOT_CHECKED',
1970
+ message: `"${n.id}" carries extension type "${payload.type}" with its own tag ("${payload.tag}"); the registry snapshot ` +
1971
+ `does not list that type, so its name is not checked. That is expected for a type a brownfield file carries ` +
1972
+ `(decompile writes it); for a node you author, check the spelling with \`uip maestro bpmn registry search\` ` +
1973
+ `and drop \`tag\`.`,
1974
+ where: n.id,
1975
+ });
1976
+ }
1977
+ }
1953
1978
  /**
1954
1979
  * Whether this node serializes to a `bpmn:StartEvent`.
1955
1980
  *
@@ -56,7 +56,7 @@
56
56
  import BpmnModdle from 'bpmn-moddle';
57
57
  import { flattenConnectorBody } from '../core/connector-inputs.js';
58
58
  import { createRequire } from 'node:module';
59
- import { registryType, rowDeclaration } from './typed-node.js';
59
+ import { isSnapshotType, registryType, rowDeclaration } from './typed-node.js';
60
60
  import { errorSchema, errorSchemaWithResponse } from './bpmn-sdk.js';
61
61
  import { SCRIPT_ARGS_ENVELOPE, defaultScriptInputSchema } from './serialize.js';
62
62
  import { BPMN_SCHEMA_VERSIONS } from './format-profile.js';
@@ -1012,19 +1012,21 @@ function listedSpec(type) {
1012
1012
  * un-importable for a node the author may never touch.
1013
1013
  */
1014
1014
  function artifactSpec(el, payload) {
1015
- const tag = String(payload.$type);
1016
- const [ns, local] = tag.split(':');
1015
+ const def = (el.eventDefinitions ?? [])[0];
1017
1016
  return {
1018
1017
  element: el.$type,
1019
1018
  // `uipath:Activity` is the moddle type; the spec spells the XML tag, `uipath:activity`.
1020
- tag: `${ns}:${local.charAt(0).toLowerCase()}${local.slice(1)}`,
1019
+ tag: payloadTagOf(payload),
1021
1020
  inputPattern: 'separateInputs',
1022
1021
  inputName: null,
1023
1022
  inputTarget: null,
1024
1023
  context: [],
1025
1024
  inputs: [],
1026
1025
  output: null,
1027
- eventDefinition: null,
1026
+ // A carried trigger's own definition, which `carriesUnlistedTrigger` has already
1027
+ // required to be bare: `bpmn:MessageEventDefinition` → `bpmn:messageEventDefinition`,
1028
+ // the spelling the snapshot uses.
1029
+ eventDefinition: def ? payloadTagOf(def) : null,
1028
1030
  requiresDiscovery: false,
1029
1031
  bindingPattern: 'none',
1030
1032
  };
@@ -1040,18 +1042,43 @@ function emitSpec(spec) {
1040
1042
  ['context', '[]'],
1041
1043
  ['inputs', '[]'],
1042
1044
  ['output', 'null'],
1043
- ['eventDefinition', 'null'],
1045
+ ['eventDefinition', spec.eventDefinition === null ? 'null' : tsText(spec.eventDefinition)],
1044
1046
  ['requiresDiscovery', 'false'],
1045
1047
  ['bindingPattern', tsText(spec.bindingPattern)],
1046
1048
  ]);
1047
1049
  }
1050
+ /** The XML tag a moddle payload was written under: `uipath:Activity` → `uipath:activity`. */
1051
+ function payloadTagOf(payload) {
1052
+ const [ns, local] = String(payload.$type).split(':');
1053
+ return `${ns}:${local.charAt(0).toLowerCase()}${local.slice(1)}`;
1054
+ }
1055
+ /**
1056
+ * A payload that DECORATES its element, as the `payload` option (`ExtensionPayload`).
1057
+ *
1058
+ * For a type the registry does not list, the payload's own tag rides along (`tag`),
1059
+ * because that tag is the one thing the builder would otherwise ask the registry for.
1060
+ * A listed type leaves it out and keeps the snapshot's. The type version is written
1061
+ * only when it is not the builder's `v1`.
1062
+ */
1063
+ function emitDecorationPayload(payload, type) {
1064
+ if (!payload || !type)
1065
+ return undefined;
1066
+ const version = payload.type?.version;
1067
+ return opts([
1068
+ ['type', tsText(type)],
1069
+ ['tag', isSnapshotType(type) ? undefined : tsText(payloadTagOf(payload))],
1070
+ ['typeVersion', version && version !== 'v1' ? tsText(version) : undefined],
1071
+ ['outputRows', emitOutputRows(payload) ?? '[]'],
1072
+ ]);
1073
+ }
1048
1074
  /**
1049
1075
  * A node whose extension type the registry does not list — carried verbatim.
1050
1076
  *
1051
1077
  * Written as `.activity()` with the spec read off the artifact ({@link artifactSpec})
1052
1078
  * and every row spelled out, so the recompile reproduces the element exactly and the
1053
- * rest of the process stays editable. Event elements never reach here: an unlisted type
1054
- * cannot describe one (`typeDescribesElement`), so the event emitter keeps the element.
1079
+ * rest of the process stays editable. An event reaches here only when its payload holds
1080
+ * rows a decoration cannot carry, with a bare definition the spec reproduces
1081
+ * (`carriesUnlistedTrigger`); any other event keeps its own emitter.
1055
1082
  */
1056
1083
  function emitUnlistedTypedNode(chain, el, payload, type) {
1057
1084
  const id = el.id;
@@ -1692,7 +1719,7 @@ function renderHandler(plan, h, depth, indent) {
1692
1719
  ['id', b.id !== `${host}_${method}` ? tsText(b.id) : undefined],
1693
1720
  ['name', b.name !== undefined ? tsText(b.name) : undefined],
1694
1721
  ['interrupting', def !== 'error' && b.cancelActivity === false ? 'false' : undefined],
1695
- ['payload', payload && type ? opts([['type', tsText(type)], ['outputRows', emitOutputRows(payload) ?? '[]']]) : undefined],
1722
+ ['payload', emitDecorationPayload(payload, type)],
1696
1723
  ]);
1697
1724
  const body = renderArmBody(plan, h.arm, depth, indent);
1698
1725
  const args = [defExpr, ...(optsText !== EMPTY_OPTS ? [optsText] : []), ...(body ? [body] : [])];
@@ -1827,9 +1854,9 @@ function renderEventSubProcess(plan, sp, depth, indent) {
1827
1854
  ['startId', start.id !== `${sp.id}_start` ? tsText(start.id) : undefined],
1828
1855
  ['startName', start.name !== undefined ? tsText(start.name) : undefined],
1829
1856
  ['startEntryPointId', entryPointOption(start)],
1830
- ['startPayload', payload && type && capture === undefined ? opts([['type', tsText(type)], ['outputRows', emitOutputRows(payload) ?? '[]']]) : undefined],
1857
+ ['startPayload', capture === undefined ? emitDecorationPayload(payload, type) : undefined],
1831
1858
  ['tags', tagsOf(sp)],
1832
- ['payload', spPayload && spType ? opts([['type', tsText(spType)], ['outputRows', emitOutputRows(spPayload) ?? '[]']]) : undefined],
1859
+ ['payload', emitDecorationPayload(spPayload, spType)],
1833
1860
  ]);
1834
1861
  const vars = new Chain('');
1835
1862
  emitVariablesInto(vars, sp, sp.id, capture !== undefined && captureDeclLooksDerived(sp, capture, start.id) ? new Set([capture]) : undefined);
@@ -2054,6 +2081,67 @@ function typeDescribesElement(kind, type) {
2054
2081
  }
2055
2082
  return !!element && localName(element).toLowerCase() === kind.toLowerCase();
2056
2083
  }
2084
+ /**
2085
+ * Whether an event carries an extension type the registry does not list, with rows
2086
+ * only a typed node can hold — so it is emitted as `.activity()` with the spec read
2087
+ * off the element (`emitUnlistedTypedNode`) rather than as a decorated event.
2088
+ *
2089
+ * The case that forced it: a queue trigger, `Orchestrator.QueueItemAdded`, on a start
2090
+ * event of deployed processes. Neither the snapshot nor `uip maestro bpmn registry
2091
+ * search` lists it, yet `bpmn validate` accepts the file and it runs:
2092
+ *
2093
+ * <bpmn:startEvent id="s">
2094
+ * <uipath:event version="v1"><uipath:type value="Orchestrator.QueueItemAdded" version="v2" />
2095
+ * <uipath:context><uipath:input name="queueName" type="string" value="=bindings.q" /></uipath:context>
2096
+ * <uipath:output name="TransactionItem" type="jsonSchema" source="=response" var="item" />
2097
+ * </uipath:event>
2098
+ * <bpmn:messageEventDefinition />
2099
+ * </bpmn:startEvent>
2100
+ *
2101
+ * The decoration form (`payload: { type, outputRows }`) has no room for the context
2102
+ * rows, and the typed form needs the element, the tag and the definition — all of
2103
+ * which the file states. The typed form writes a definition with nothing in it, so
2104
+ * only a bare one (no reference, no body; an `id` is fine) is carried; anything else, and an
2105
+ * attribute `.activity()` cannot write (a boundary's host, a non-interrupting start),
2106
+ * refuses here instead of losing it.
2107
+ *
2108
+ * A payload with output rows alone stays a decoration, so the element keeps every
2109
+ * event option it has (`emitDecorationPayload` carries the tag).
2110
+ */
2111
+ function carriesUnlistedTrigger(el, kind, payload, type) {
2112
+ if (!EVENT_KINDS.has(kind) || listedSpec(type))
2113
+ return false;
2114
+ const describes = (payload.context?.input?.length ?? 0) > 0 || payload.context?.inputSchema !== undefined || (payload.input?.length ?? 0) > 0;
2115
+ if (!describes)
2116
+ return false;
2117
+ const defs = el.eventDefinitions ?? [];
2118
+ // An `id` alone still counts as bare: the builder writes no definition id for any
2119
+ // event (`.startEvent({ message })` neither), and `bpmn merge` keeps the original's.
2120
+ const bare = defs.length === 0 || (defs.length === 1 && definitionIsBare(defs[0]));
2121
+ if (kind === 'boundaryEvent' || !bare || el.isInterrupting === false) {
2122
+ throw new Error(`${kind} "${el.id}" carries extension type "${type}", which the registry does not list, with context or input rows; ` +
2123
+ 'only a non-boundary event with at most one bare event definition can carry them, so it is refused rather than written without them.');
2124
+ }
2125
+ return true;
2126
+ }
2127
+ /**
2128
+ * Whether an event definition says nothing but its kind (and, at most, its own id):
2129
+ * no reference (`messageRef`), no body (a timer's schedule), no foreign attribute.
2130
+ * Read through the moddle descriptor, because a resolved reference such as
2131
+ * `messageRef` is not an own key of the element.
2132
+ */
2133
+ function definitionIsBare(def) {
2134
+ if (Object.keys(def.$attrs ?? {}).length)
2135
+ return false;
2136
+ for (const p of def.$descriptor?.properties ?? []) {
2137
+ if (p.name === 'id')
2138
+ continue;
2139
+ const v = def.get ? def.get(p.name) : def[p.name];
2140
+ if (v !== undefined && v !== null && !(Array.isArray(v) && v.length === 0))
2141
+ return false;
2142
+ }
2143
+ return true;
2144
+ }
2057
2145
  /**
2058
2146
  * An event element, with whatever payload it carries as an option on it.
2059
2147
  *
@@ -2064,12 +2152,7 @@ function emitEvent(chain, el, kind, payload, type) {
2064
2152
  // `outputRows` is the only payload shape an event carries in the corpus. A
2065
2153
  // `context` or `input` row on one would mean the registry describes the element
2066
2154
  // after all, which is the branch this function is not on.
2067
- const eventPayload = payload && type
2068
- ? opts([
2069
- ['type', tsText(type)],
2070
- ['outputRows', emitOutputRows(payload) ?? '[]'],
2071
- ])
2072
- : undefined;
2155
+ const eventPayload = emitDecorationPayload(payload, type);
2073
2156
  if (kind === 'boundaryEvent') {
2074
2157
  chain.add(`.boundaryEvent(${tsText(el.id)}, ${opts([
2075
2158
  ['name', el.name !== undefined ? tsText(el.name) : undefined],
@@ -2139,6 +2222,11 @@ function emitElement(chain, el, depth, indent) {
2139
2222
  // ARE start events in the registry, so they keep the typed path and their context.
2140
2223
  const elementWins = ELEMENT_OWNS.has(kind) && !typeDescribesElement(kind, type);
2141
2224
  if (elementWins) {
2225
+ // An unlisted type whose payload carries context or input rows is not a
2226
+ // decoration: it describes the event (a queue trigger). Its rows and its bare
2227
+ // definition are all in the file, so it is carried like an unlisted task.
2228
+ if (payload && type && carriesUnlistedTrigger(el, kind, payload, type))
2229
+ return emitUnlistedTypedNode(chain, el, payload, type);
2142
2230
  if (EVENT_KINDS.has(kind))
2143
2231
  return emitEvent(chain, el, kind, payload, type);
2144
2232
  if (kind === 'scriptTask')
@@ -2262,12 +2350,7 @@ function emitElement(chain, el, depth, indent) {
2262
2350
  ['name', el.name !== undefined ? tsText(el.name) : undefined],
2263
2351
  [
2264
2352
  'payload',
2265
- spPayload && spType
2266
- ? opts([
2267
- ['type', tsText(spType)],
2268
- ['outputRows', emitOutputRows(spPayload) ?? '[]'],
2269
- ])
2270
- : undefined,
2353
+ emitDecorationPayload(spPayload, spType),
2271
2354
  ],
2272
2355
  ['triggeredByEvent', el.triggeredByEvent ? 'true' : undefined],
2273
2356
  ['loop', emitLoop(el)],
@@ -2789,7 +2872,8 @@ lifted = new Set()) {
2789
2872
  // spelled out (`emitUnlistedTypedNode`), and those rows declare their variables on
2790
2873
  // the way back in like any typed node's — so they are candidates too, wherever the
2791
2874
  // typed path is the one that writes the element.
2792
- const unlistedTyped = !!payload && !!type && type !== 'BPMN.Variables' && !ELEMENT_OWNS.has(localName(el.$type)) && !listedSpec(type);
2875
+ const unlistedTyped = !!payload && !!type && type !== 'BPMN.Variables' && !listedSpec(type)
2876
+ && (!ELEMENT_OWNS.has(localName(el.$type)) || carriesUnlistedTrigger(el, localName(el.$type), payload, type));
2793
2877
  if (payload && type && (spelledOutScriptRows || unlistedTyped || (type !== 'BPMN.Variables' && typeDescribesElement(localName(el.$type), type)))) {
2794
2878
  for (const row of payload.output ?? []) {
2795
2879
  if (!row.var)
@@ -872,7 +872,7 @@ function attachExtensionPayload(ctx, el, payload) {
872
872
  if (!payload)
873
873
  return;
874
874
  const ext = (el.extensionElements ??= ctx.m.create('bpmn:ExtensionElements', { values: [] }));
875
- (ext.values ??= []).unshift(createExtensionPayload(ctx.m, payload.type, payload.outputRows));
875
+ (ext.values ??= []).unshift(createExtensionPayload(ctx.m, payload.type, payload.outputRows, { tag: payload.tag, typeVersion: payload.typeVersion }));
876
876
  }
877
877
  /**
878
878
  * Attach what every ACTIVITY can carry — a retry policy and a multi-instance loop
@@ -451,7 +451,10 @@ export declare function verbatimOutputRows(m: BpmnModdle, rows: TypedOutputRow[]
451
451
  * @param rows - Output rows, emitted verbatim.
452
452
  * @returns The payload element, ready to go inside a `bpmn:ExtensionElements`.
453
453
  */
454
- export declare function createExtensionPayload(m: BpmnModdle, type: string, rows: TypedOutputRow[]): El;
454
+ export declare function createExtensionPayload(m: BpmnModdle, type: string, rows: TypedOutputRow[], carried?: {
455
+ tag?: string;
456
+ typeVersion?: string;
457
+ }): El;
455
458
  /**
456
459
  * The context fields this type requires to be a `=bindings.<id>` reference rather
457
460
  * than a literal.
@@ -655,19 +655,44 @@ export function verbatimOutputRows(m, rows) {
655
655
  * @param rows - Output rows, emitted verbatim.
656
656
  * @returns The payload element, ready to go inside a `bpmn:ExtensionElements`.
657
657
  */
658
- export function createExtensionPayload(m, type, rows) {
659
- const spec = registryType(type);
660
- if (!spec.tag) {
661
- throw new CompileRefusal('BPMN_TYPE_NOT_AUTHORABLE', `extension type "${type}" has no tag in the registry snapshot; it cannot be authored.`);
662
- }
658
+ export function createExtensionPayload(m, type, rows, carried) {
659
+ const tag = payloadTag(type, carried?.tag);
663
660
  const payload = {
664
661
  version: 'v1',
665
- type: m.create('uipath:Type', { value: type, version: 'v1' }),
662
+ type: m.create('uipath:Type', { value: type, version: carried?.typeVersion ?? 'v1' }),
666
663
  };
667
664
  const out = verbatimOutputRows(m, rows);
668
665
  if (out.length)
669
666
  payload.output = out;
670
- return m.create(moddleTypeOf(spec.tag), payload);
667
+ return m.create(moddleTypeOf(tag), payload);
668
+ }
669
+ /** The three tags an extension payload is written under. */
670
+ const PAYLOAD_TAGS = new Set(['uipath:activity', 'uipath:event', 'uipath:mapping']);
671
+ /**
672
+ * The tag a decoration payload is written under: the snapshot's for a type it lists,
673
+ * else the tag the file carried, else whatever the registry says (which refuses an
674
+ * unknown type with `BPMN_TYPE_UNKNOWN`).
675
+ *
676
+ * A decoration needs nothing from the spec but its tag, so a type the snapshot lacks
677
+ * is fully described by the tag the file wrote it under — `uipath:type value="None"`
678
+ * inside a `uipath:activity` on a case trigger. The carried tag is the third source,
679
+ * after the snapshot and before the tenant: accepted, never demanded, and never
680
+ * allowed to override a type the snapshot knows. It is checked against the three
681
+ * tags that exist, so a typo still refuses instead of writing an element no reader
682
+ * knows.
683
+ */
684
+ function payloadTag(type, carried) {
685
+ if (carried !== undefined && !isSnapshotType(type)) {
686
+ if (!PAYLOAD_TAGS.has(carried)) {
687
+ throw new CompileRefusal('BPMN_PAYLOAD_TAG_INVALID', `extension payload "${type}" carries tag "${carried}"; expected one of ${[...PAYLOAD_TAGS].join(', ')}.`);
688
+ }
689
+ return carried;
690
+ }
691
+ const spec = registryType(type);
692
+ if (!spec.tag) {
693
+ throw new CompileRefusal('BPMN_TYPE_NOT_AUTHORABLE', `extension type "${type}" has no tag in the registry snapshot; it cannot be authored.`);
694
+ }
695
+ return spec.tag;
671
696
  }
672
697
  /** Wrap a finished payload in its BPMN element. */
673
698
  function finish(m, spec, id, name, payload) {
package/dist/bpmn-api.md CHANGED
@@ -480,6 +480,7 @@ What every ACTIVITY accepts, on top of its own options — a script task, a vari
480
480
  - `ConnectorOpts.connection?: string` — Symbolic connection name declared in bindings.json (→ ConnectionId).
481
481
  - `ConnectorOpts.folder?: string` — Symbolic folder name declared in bindings.json (→ connectionFolderKey).
482
482
  - `ConnectorOpts.object?: string` — Which OBJECT a **generic** operation addresses — e.g. ServiceNow's "List All Records" on `'acr_user'`, NetSuite's "Get…
483
+ - `ConnectorOpts.carried?: CarriedConnectorOperation` — Flow only, and written by decompile, not by an author: the `.flow` file's own description of an operation the connector…
483
484
 
484
485
  ### `HumanTaskAppOpts`
485
486
 
@@ -833,6 +834,8 @@ An extension payload carried by an element the payload does not describe.
833
834
 
834
835
  - `ExtensionPayload.type: string` — The extension type, e.g. `'BPMN.Variables'` or `'uipath:Activity'`.
835
836
  - `ExtensionPayload.outputRows: TypedOutputRow[]` — `uipath:output` rows, emitted exactly as given — see TypedOutputRow.
837
+ - `ExtensionPayload.tag?: 'uipath:activity' | 'uipath:event' | 'uipath:mapping'` — The payload's own tag — `'uipath:activity'`, `'uipath:event'` or `'uipath:mapping'` — for a `type` the registry snapshot…
838
+ - `ExtensionPayload.typeVersion?: string` — The `uipath:type` `version` attribute, when it is not `v1` — see `ActivityNodeOpts.typeVersion`.
836
839
 
837
840
  ### `GatewayKind`
838
841
 
@@ -1064,6 +1067,15 @@ One lookup field's retrieval contract, generated from `reference`.
1064
1067
  - `LookupSpec.strategy: LookupStrategy`
1065
1068
  - `LookupSpec.dependsOn?: readonly string[]` — For `strategy: 'dependent'`, the fields that must resolve first.
1066
1069
 
1070
+ ### `CarriedConnectorOperation`
1071
+
1072
+ The file's description of a connector operation the library lacks; see the module comment.
1073
+
1074
+ - `CarriedConnectorOperation.method: string` — The HTTP method the node calls, as the file saved it (`detail.method`), e.g. `POST`.
1075
+ - `CarriedConnectorOperation.endpoint: string` — The endpoint the node calls (`detail.endpoint`), e.g. `/v2/{entityName}/CreateEntityRecord`.
1076
+ - `CarriedConnectorOperation.operation?: string` — The operation verb the node's configuration records (`essentialConfiguration.operation`), e.g. `create` or `list`.
1077
+ - `CarriedConnectorOperation.fields?: readonly CarriedConnectorField[]` — Every input the node sets, with the slot it rides in.
1078
+
1067
1079
  ### `DataServiceFolderEntity`
1068
1080
 
1069
1081
  A Data Fabric entity in an Orchestrator folder — what Studio Web's folder-scoped entity picker selects, as opposed to a…
@@ -1085,6 +1097,14 @@ How `prepare` should retrieve the collection, chosen from the metadata.
1085
1097
 
1086
1098
  - `type LookupStrategy = 'filter' | 'scan' | 'tree' | 'dependent'`
1087
1099
 
1100
+ ### `CarriedConnectorField`
1101
+
1102
+ One input field a connector task carries from the plan it was decompiled from.
1103
+
1104
+ - `CarriedConnectorField.name: string` — The field's name, as the saved field list names it, e.g. `bodyFormat`.
1105
+ - `CarriedConnectorField.location: CarriedFieldLocation` — The wire slot the saved field list names (`fieldLocation`).
1106
+ - `CarriedConnectorField.type?: string` — `string`, `number`, `boolean`, `array` or `object`, when the saved field declares one.
1107
+
1088
1108
  ### `HumanTaskFormField`
1089
1109
 
1090
1110
  One field of an inline human-task form.
@@ -1097,6 +1117,12 @@ One button the reviewer can finish the task with.
1097
1117
 
1098
1118
  - `type HumanTaskOutcome = string | { name: string; id?: string; }`
1099
1119
 
1120
+ ### `CarriedFieldLocation`
1121
+
1122
+ Where a carried field rides on the wire: the request body, the query string or the path.
1123
+
1124
+ - `type CarriedFieldLocation = Extract<FieldLocation, 'body' | 'query' | 'path'>`
1125
+
1100
1126
  ### `HumanTaskShownField`
1101
1127
 
1102
1128
  A value the reviewer READS: shown on the form, filled in from the process.
package/dist/check-cli.js CHANGED
@@ -93,7 +93,7 @@ async function checkAgainstBaseline(built, originalPath, original, opts, package
93
93
  const loaded = await loadNodePackages(originalPath, original, packages);
94
94
  for (const message of loaded.warnings)
95
95
  console.error(`check: warning: ${message}`);
96
- const baseline = await withDecompiledOriginal(originalPath, (b) => checkCompiled(b, opts), (m) => console.error(`check: decompile warning: ${m}`));
96
+ const baseline = await withDecompiledOriginal(originalPath, (b) => checkCompiled(b, opts), (m) => console.error(`check: decompile warning: ${m}`), opts.library ? { library: opts.library } : {});
97
97
  return scopeToEdit(checkCompiled(built, opts), baseline);
98
98
  }
99
99
  /**
@@ -107,11 +107,13 @@ export function registerFlowCommands(program) {
107
107
  .option('--no-pipeline', 'do not emit a brownfield pipeline helper')
108
108
  .option('--package <name...>', 'trust and load this node-type package (repeatable); otherwise package.json "maestroBuilderSdk".nodePackages decides')
109
109
  .option('--scripts <form>', 'print script steps as "function" (the default) or "string"')
110
+ .option('--library <dir>', 'connector library compile will use (default $FLOW_SDK_LIBRARY_JSON, else the pulled cache); an operation it lacks is carried from the file')
110
111
  .action(async (input, options) => {
111
112
  const argv = [input];
112
113
  addValue(argv, '-o', options.output);
113
114
  addValue(argv, '--import', options.import);
114
115
  addValue(argv, '--scripts', options.scripts);
116
+ addValue(argv, '--library', options.library);
115
117
  if (options.strict)
116
118
  argv.push('--strict');
117
119
  if (options.pipeline === false)
@@ -12,6 +12,7 @@ import type { LookupToken } from './lookups.js';
12
12
  import type { EventFilterExpression } from './event-filters.js';
13
13
  export type { EventFilterExpression } from './event-filters.js';
14
14
  import { type ConnectorDescriptor, type TriggerDescriptor } from './connectors.js';
15
+ import type { CarriedConnectorOperation } from './carried-connector-operation.js';
15
16
  export interface ConnectorOpts {
16
17
  /** Connector action version (defaults to the library's newest match). */
17
18
  version?: string;
@@ -55,6 +56,20 @@ export interface ConnectorOpts {
55
56
  * different object is an error: nothing could make that right.
56
57
  */
57
58
  object?: string;
59
+ /**
60
+ * Flow only, and written by decompile, not by an author: the `.flow` file's own
61
+ * description of an operation the connector library does not have — the
62
+ * method and endpoint its node calls, the verb its configuration records, and
63
+ * the slot of each input it sets. Compile reads it only when the library has
64
+ * no entry for the node type, together with the definition the source carries
65
+ * in `.definitions([...])`; see `core/carried-connector-operation.ts`.
66
+ *
67
+ * ```ts
68
+ * { method: 'POST', endpoint: '/v2/{entityName}/CreateEntityRecord', operation: 'create',
69
+ * fields: [{ name: 'Name', location: 'body' }, { name: 'entityName', location: 'path' }] }
70
+ * ```
71
+ */
72
+ carried?: CarriedConnectorOperation;
58
73
  }
59
74
  /**
60
75
  * The platform's 11 canonical quick-form field types (`@uipath/hitl-schema-types`
@@ -924,6 +939,8 @@ export interface FlowActionSpecs {
924
939
  folder?: string;
925
940
  /** Which OBJECT a generic operation addresses — see {@link ConnectorOpts.object}. */
926
941
  object?: string;
942
+ /** The file's description of an operation the library lacks — see {@link ConnectorOpts.carried}. */
943
+ carried?: CarriedConnectorOperation;
927
944
  /** The operation's inputs, by field. */
928
945
  inputs: Record<string, unknown>;
929
946
  };
@@ -60,6 +60,7 @@ export function connector(a, b, c, d) {
60
60
  connection: opts.connection,
61
61
  folder: opts.folder,
62
62
  object: opts.object,
63
+ ...(opts.carried !== undefined ? { carried: opts.carried } : {}),
63
64
  inputs: c ?? {},
64
65
  });
65
66
  }
@@ -74,6 +75,7 @@ export function connector(a, b, c, d) {
74
75
  connection: opts.connection,
75
76
  folder: opts.folder,
76
77
  object: opts.object ?? a.objectName,
78
+ ...(opts.carried !== undefined ? { carried: opts.carried } : {}),
77
79
  inputs: b ?? {},
78
80
  });
79
81
  }
@@ -0,0 +1,120 @@
1
+ /**
2
+ * A connector operation a decompiled Flow step CARRIES: the file's own
3
+ * description of an operation the connector library does not have at all.
4
+ *
5
+ * The published library is a snapshot. A tenant keeps adding connectors and
6
+ * operations after it is taken (Data Fabric `create-entity-record`, Test
7
+ * Manager, a tenant's custom connector), and Studio Web saves a step against the
8
+ * LIVE connector. With the library as the only authority, compile refused such a
9
+ * step as CONNECTOR_NOT_IN_LIBRARY, so the source decompile wrote for an
10
+ * untouched product flow did not compile.
11
+ *
12
+ * The `.flow` file describes the operation in two places, and between them they
13
+ * hold everything compile reads from a library entry:
14
+ *
15
+ * - its `definitions[]` entry for the node type: the form, handles, model,
16
+ * bindings and activity type id. Decompile carries it in `.definitions([...])`,
17
+ * exactly as it carries a pinned core node's definition (#1128).
18
+ * - the node's own `inputs.detail`: the HTTP method and endpoint it calls, the
19
+ * operation verb its configuration records, and the slot (body, query, path)
20
+ * of every input it sets. Decompile carries these as the step's `carried`
21
+ * option: `{ method, endpoint, operation, fields }`.
22
+ *
23
+ * This is the same idea as Case's carried connector fields
24
+ * (`core/carried-connector-fields.ts`, #1362): the file's own definition is the
25
+ * third source, after the SDK and the library. It is a FALLBACK only:
26
+ *
27
+ * - compile reads it only when the library has no entry for the node type. An
28
+ * operation the library knows is compiled from the library, whatever is
29
+ * carried, so a carried copy can never relax what the library declares.
30
+ * - it names only the inputs the file sets. An input it does not name is still
31
+ * `unknown input` (CONNECTOR_INPUT). A carried field is optional, except a
32
+ * path field the endpoint template names (`{entityName}`): the file shows
33
+ * that a field exists, not that it is required, but an unfilled placeholder
34
+ * is a node `flow validate` refuses.
35
+ * - the method must be one `flow validate` accepts, every `{name}` in the
36
+ * endpoint needs a carried path field, and the carried definition must record
37
+ * the step's connector key and method (`carriedDefinitionMismatch`).
38
+ * - without the carried definition in `.definitions([...])`, the step is still
39
+ * CONNECTOR_NOT_IN_LIBRARY.
40
+ *
41
+ * For instance a Data Fabric "Create Entity Record" step, saved against a
42
+ * connector newer than the library, decompiles to
43
+ *
44
+ * ```ts
45
+ * connector("uipath-uipath-dataservice", "create-entity-record", { Name: "Ada", entityName: "Contact" }, {
46
+ * connection: "…", folder: "…",
47
+ * carried: { method: "POST", endpoint: "/v2/{entityName}/CreateEntityRecord", operation: "create",
48
+ * fields: [{ name: "Name", location: "body" }, { name: "entityName", location: "path" }] },
49
+ * })
50
+ * ```
51
+ *
52
+ * plus `.definitions([createEntityRecordV1_0_0Definition])`, and compiles back.
53
+ */
54
+ import { type CarriedConnectorField } from './carried-connector-fields.js';
55
+ import type { ResolvedConnector } from './library.js';
56
+ /** The file's description of a connector operation the library lacks; see the module comment. */
57
+ export interface CarriedConnectorOperation {
58
+ /** The HTTP method the node calls, as the file saved it (`detail.method`), e.g. `POST`. */
59
+ method: string;
60
+ /** The endpoint the node calls (`detail.endpoint`), e.g. `/v2/{entityName}/CreateEntityRecord`. */
61
+ endpoint: string;
62
+ /** The operation verb the node's configuration records (`essentialConfiguration.operation`), e.g. `create` or `list`. */
63
+ operation?: string;
64
+ /** Every input the node sets, with the slot it rides in. Each is optional to compile; any other input is refused. */
65
+ fields?: readonly CarriedConnectorField[];
66
+ }
67
+ /**
68
+ * The `{name}` placeholders in an endpoint template, in order. For instance
69
+ * `/v2/{ProjectId}/testsets/{id}` gives `['ProjectId', 'id']`.
70
+ */
71
+ export declare function endpointPlaceholders(endpoint: string): string[];
72
+ /**
73
+ * Why `carried` cannot be a step's carried operation, or `undefined` when it can.
74
+ *
75
+ * For instance `{ endpoint: '/send' }` is refused for naming no `method`.
76
+ */
77
+ export declare function carriedOperationRefusal(carried: unknown, where: string): string | undefined;
78
+ /**
79
+ * Why `definition` cannot be the definition of carried operation `carried` on
80
+ * connector `key`, or `undefined` when it can: the connector key and HTTP
81
+ * method the definition itself records must agree with the step's. A
82
+ * definition borrowed from another connector, or from an operation with
83
+ * another verb, is refused. A definition that records neither is not checked
84
+ * on that point.
85
+ *
86
+ * For instance a Slack POST operation's definition under
87
+ * `carried: { method: 'DELETE', … }` is refused.
88
+ */
89
+ export declare function carriedDefinitionMismatch(definition: Record<string, unknown>, key: string, carried: CarriedConnectorOperation, where: string): string | undefined;
90
+ /**
91
+ * The operation `carried` and the carried `definition` describe, resolved as
92
+ * `Library.resolve` resolves a library entry. `carried` must have passed
93
+ * {@link carriedOperationRefusal}.
94
+ *
95
+ * The entry is built from the two halves: the transport (method, endpoint, verb)
96
+ * from `carried`, the object, activity kind and connector name from the
97
+ * definition. The fields are the carried ones, optional except a path field
98
+ * the endpoint template names.
99
+ *
100
+ * @param nodeType - The step's node type, `uipath.connector.<key>.<action>`.
101
+ * @param key - The connector key.
102
+ * @param version - The step's pinned version, which the definition carries.
103
+ * @param definition - The carried `definitions[]` entry for `nodeType@version`.
104
+ * @param carried - The step's carried operation.
105
+ */
106
+ export declare function carriedConnector(nodeType: string, key: string, version: string, definition: Record<string, unknown>, carried: CarriedConnectorOperation): ResolvedConnector;
107
+ /**
108
+ * The operation a saved connector node describes, for decompile to carry: its
109
+ * method, endpoint, the verb its configuration records, and each input it sets
110
+ * with its slot. `undefined` when the node does not describe one compile could
111
+ * rebuild: no method `flow validate` accepts or no endpoint, a multipart part
112
+ * (its part list is the library's to declare), one name in two slots, or an
113
+ * endpoint placeholder no path parameter fills.
114
+ *
115
+ * For instance a node with `detail: { method: 'POST', endpoint: '/send', bodyParameters: { text: 'hi' } }`
116
+ * gives `{ method: 'POST', endpoint: '/send', fields: [{ name: 'text', location: 'body' }] }`.
117
+ *
118
+ * @param detail - The node's `inputs.detail`.
119
+ */
120
+ export declare function carriedOperationOf(detail: Record<string, unknown>): CarriedConnectorOperation | undefined;