@uipath/maestro-builder-sdk 6.38.0 → 6.40.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.
@@ -19,6 +19,7 @@ import { createConnectorTask } from './connector.js';
19
19
  import { createConnectorEvent, createExternalTask, intsvcOutputVar } from './intsvc.js';
20
20
  import { createExtensionPayload, createTypedNode, rowDeclaration, typedNodeOutputVar, verbatimOutputRows } from './typed-node.js';
21
21
  import { connectorOutputVars, typedNodeDeclaredVars } from './declared-vars.js';
22
+ import { defaultEntryPointId } from './entry-point-id.js';
22
23
  const require = createRequire(import.meta.url);
23
24
  const uipathDescriptor = require('./uipath-moddle.v1.json');
24
25
  const NS = {
@@ -138,16 +139,7 @@ export async function serialize(built, opts = {}) {
138
139
  const meta = built.metadata;
139
140
  if (meta?.migrationVersion !== undefined)
140
141
  processExt.push(m.create('uipath:MigrationVersion', { version: meta.migrationVersion }));
141
- if (meta?.entryPointId !== undefined) {
142
- // The package metadata generator discovers entry points by reading the root start
143
- // event. A process-level `uipath:entryPointId` looks plausible and validates as XML,
144
- // but is invisible to `update-metadata`, which then writes an empty entry-points.json.
145
- const start = flowElements.find((element) => element.$type === 'bpmn:StartEvent');
146
- if (start) {
147
- const extensions = (start.extensionElements ??= m.create('bpmn:ExtensionElements', { values: [] }));
148
- (extensions.values ??= []).unshift(m.create('uipath:EntryPointId', { value: meta.entryPointId }));
149
- }
150
- }
142
+ stampEntryPointIds(ctx, built, flowElements, meta?.entryPointId);
151
143
  if (meta?.tags !== undefined && meta.tags.length > 0)
152
144
  processExt.push(m.create('uipath:Tags', { tags: meta.tags.map((t) => m.create('uipath:Tag', { value: t })) }));
153
145
  if (meta?.caseManagement !== undefined)
@@ -218,6 +210,57 @@ export function processId(id) {
218
210
  return /^[A-Za-z_][\w.-]*$/.test(id) ? id : 'Process_1';
219
211
  }
220
212
  // ─── Scope (process root or a sub-process body) ───────────────────────────────
213
+ /**
214
+ * `uipath:entryPointId` on the process's root start events, triggered or manual.
215
+ *
216
+ * The package metadata generator discovers entry points by reading the root start
217
+ * events — a process-level `uipath:entryPointId` looks plausible and validates as XML,
218
+ * but is invisible to `update-metadata`, which then writes an empty entry-points.json
219
+ * — and `uip maestro bpmn refresh` requires exactly one, a GUID, on each root manual
220
+ * start. The canvas writes one on every ROOT start and strips any inside a
221
+ * `bpmn:SubProcess` on save, so a nested start gets no derived id here, only one the
222
+ * author set. A root start takes, in order: the event's own option, else
223
+ * `.metadata({ entryPointId })` for the first root start in chain order, else the
224
+ * stable derived id (`entry-point-id.ts`, seeded from the builder's own process id, so
225
+ * two processes with the same start id derive different ids); `false` writes none.
226
+ */
227
+ function stampEntryPointIds(ctx, built, flowElements, rootDefault) {
228
+ const { m } = ctx;
229
+ const own = new Map();
230
+ for (const n of allNodes(built.nodes)) {
231
+ if (n.kind === 'startEvent' || n.kind === 'connectorEvent' || n.kind === 'typed')
232
+ own.set(n.id, n.entryPointId);
233
+ }
234
+ let first = true;
235
+ const stamp = (el, value) => {
236
+ if (value === undefined || value === false)
237
+ return;
238
+ const extensions = (el.extensionElements ??= m.create('bpmn:ExtensionElements', { values: [] }));
239
+ const values = (extensions.values ??= []);
240
+ if (values.some((x) => x.$type === 'uipath:EntryPointId'))
241
+ return;
242
+ values.unshift(m.create('uipath:EntryPointId', { value }));
243
+ };
244
+ const visit = (elements, root) => {
245
+ for (const el of elements) {
246
+ if (el.$type === 'bpmn:SubProcess') {
247
+ visit(el.flowElements ?? [], false);
248
+ continue;
249
+ }
250
+ if (el.$type !== 'bpmn:StartEvent')
251
+ continue;
252
+ const explicit = own.get(el.id);
253
+ if (!root) {
254
+ stamp(el, explicit);
255
+ continue;
256
+ }
257
+ const value = explicit !== undefined ? explicit : first && rootDefault !== undefined ? rootDefault : defaultEntryPointId(built.id, el.id);
258
+ first = false;
259
+ stamp(el, value);
260
+ }
261
+ };
262
+ visit(flowElements, true);
263
+ }
221
264
  /** Build the flowElements array for one scope, wiring all references within it. */
222
265
  function buildScope(ctx, nodes, flows) {
223
266
  const { m } = ctx;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.38.0",
3
+ "version": "6.40.0",
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",
@@ -93,5 +93,5 @@
93
93
  "@types/node": "^22.7.0",
94
94
  "esbuild": "^0.28.1"
95
95
  },
96
- "gitref": "56a00223262864847db6153351a39d877939abb7"
96
+ "gitref": "b3dd153cbf30937f6caf22ae3ad103d6ea678cb1"
97
97
  }