@uipath/maestro-sdk 1.207.0-preview.327 → 1.207.0-preview.328

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.
@@ -113,6 +113,131 @@ var MANAGED_HTTP_KEYS = new Set([
113
113
  "query",
114
114
  "body"
115
115
  ]);
116
+ // src/bpmn-packaging/node-utils.ts
117
+ function extensionValues(element) {
118
+ return element.extensionElements?.values ?? [];
119
+ }
120
+ function childNodes(node) {
121
+ return node?.$children ?? [];
122
+ }
123
+ function required(value, label) {
124
+ if (!value?.trim()) {
125
+ throw new Error(`${label} is required.`);
126
+ }
127
+ return value.trim();
128
+ }
129
+ function allFlowElements(element) {
130
+ const result = [];
131
+ for (const child of element.flowElements ?? []) {
132
+ result.push(child, ...allFlowElements(child));
133
+ }
134
+ return result;
135
+ }
136
+ var CONNECTION_CONNECTOR_TYPES = new Set([
137
+ "Intsvc.ActivityExecution",
138
+ "Intsvc.EventTrigger",
139
+ "Intsvc.WaitForEvent"
140
+ ]);
141
+ var EXTERNAL_EXECUTION_TYPES = new Set([
142
+ "Intsvc.AsyncExecution",
143
+ "Intsvc.SyncAgentExecution",
144
+ "Intsvc.AsyncAgentExecution",
145
+ "Intsvc.AsyncWorkflowExecution",
146
+ "Intsvc.SyncWorkflowExecution"
147
+ ]);
148
+ var BINDING_NODE_TYPES = new Set([
149
+ ...CONNECTION_CONNECTOR_TYPES,
150
+ ...EXTERNAL_EXECUTION_TYPES,
151
+ "Intsvc.UnifiedHttpRequest"
152
+ ]);
153
+ function connectorNodes(process, types = CONNECTION_CONNECTOR_TYPES) {
154
+ return allFlowElements(process).flatMap((element) => {
155
+ const payload = extensionValues(element).find((node) => node.$type === "uipath:activity" || node.$type === "uipath:event");
156
+ const extensionType = childNodes(payload).find((node) => node.$type === "uipath:type")?.value;
157
+ if (extensionType === undefined || !types.has(extensionType)) {
158
+ return [];
159
+ }
160
+ const context = childNodes(payload).find((node) => node.$type === "uipath:context");
161
+ const values = new Map([...childNodes(context), ...childNodes(payload)].filter((node) => node.$type === "uipath:input" && node.name).map((node) => [
162
+ node.name,
163
+ node.value ?? node.$body
164
+ ]));
165
+ return [{ element, extensionType, values }];
166
+ });
167
+ }
168
+ var connectionReference = (values) => [values.get("connection"), values.get("connectionId")].find((value) => value?.trim());
169
+ var bindingIdOf = (value) => /^=bindings\.([A-Za-z_][\w.-]*)$/.exec(value ?? "")?.[1];
170
+ var rootBindingNodes = (process) => childNodes(extensionValues(process).find((node) => node.$type === "uipath:bindings")).filter((node) => node.$type === "uipath:binding");
171
+ var collaborationBindingNodes = (process) => (process.$parent?.rootElements ?? []).filter((element) => element.$type === "bpmn:Collaboration").flatMap(rootBindingNodes);
172
+ var connectionBindingNodes = (process) => rootBindingNodes(process).filter((node) => node.resource === "Connection" && node.propertyAttribute === "ConnectionId");
173
+
174
+ // src/bpmn-packaging/business-rule-resources.ts
175
+ var BUSINESS_RULE_RESOURCE = "BusinessRule";
176
+ var BUSINESS_RULE_TASK_TYPES = new Set([
177
+ "Orchestrator.BusinessRules"
178
+ ]);
179
+ var FOLDER_ATTRIBUTES = new Set([
180
+ "folderKey",
181
+ "folderPath"
182
+ ]);
183
+ function buildBusinessRuleResources(processes) {
184
+ const rows = new Map;
185
+ for (const process of processes) {
186
+ const bindings = [
187
+ ...rootBindingNodes(process),
188
+ ...collaborationBindingNodes(process)
189
+ ];
190
+ const ruleBindings = bindings.filter((binding) => binding.resource === BUSINESS_RULE_RESOURCE && binding.id && binding.resourceKey && !FOLDER_ATTRIBUTES.has(binding.propertyAttribute ?? ""));
191
+ if (ruleBindings.length === 0)
192
+ continue;
193
+ const tasks = connectorNodes(process, BUSINESS_RULE_TASK_TYPES);
194
+ for (const binding of ruleBindings) {
195
+ const key = binding.resourceKey;
196
+ if (rows.has(key))
197
+ continue;
198
+ const task = tasks.find((candidate) => [...candidate.values.values()].some((value) => bindingIdOf(value) === binding.id));
199
+ if (task === undefined)
200
+ continue;
201
+ rows.set(key, businessRuleRow(binding, task.element, resolve(task.values.get("name"), bindings), resolve(task.values.get("folderPath"), bindings)));
202
+ }
203
+ }
204
+ return [...rows.values()];
205
+ }
206
+ function resolve(value, bindings) {
207
+ const id = bindingIdOf(value);
208
+ const resolved = id === undefined ? value : bindings.find((binding) => binding.id === id)?.default;
209
+ return resolved?.startsWith("=") ? undefined : resolved;
210
+ }
211
+ function businessRuleRow(binding, task, name, folderPath) {
212
+ const key = binding.resourceKey;
213
+ const value = {};
214
+ if (folderPath) {
215
+ value.folderPath = {
216
+ defaultValue: folderPath,
217
+ isExpression: false,
218
+ displayName: "Folder path"
219
+ };
220
+ }
221
+ if (name) {
222
+ value.name = {
223
+ defaultValue: name,
224
+ isExpression: false,
225
+ displayName: "Business rule"
226
+ };
227
+ }
228
+ return {
229
+ resource: BUSINESS_RULE_RESOURCE,
230
+ key,
231
+ id: `${BUSINESS_RULE_RESOURCE}${key}`,
232
+ value,
233
+ metadata: {
234
+ ActivityName: task.name?.trim() || task.id || "",
235
+ BindingsVersion: BINDINGS_VERSION,
236
+ DisplayLabel: binding.name ?? ""
237
+ }
238
+ };
239
+ }
240
+
116
241
  // ../common/src/guid.ts
117
242
  var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
118
243
  function isGuid(value) {
@@ -10710,63 +10835,6 @@ function isIntsvcActivityExecutionV1(nodeVersion, workflowVersion) {
10710
10835
  return version === undefined || version === ACTIVITY_CONFIGURATION_V1;
10711
10836
  }
10712
10837
 
10713
- // src/bpmn-packaging/node-utils.ts
10714
- function extensionValues(element) {
10715
- return element.extensionElements?.values ?? [];
10716
- }
10717
- function childNodes(node) {
10718
- return node?.$children ?? [];
10719
- }
10720
- function required(value, label) {
10721
- if (!value?.trim()) {
10722
- throw new Error(`${label} is required.`);
10723
- }
10724
- return value.trim();
10725
- }
10726
- function allFlowElements(element) {
10727
- const result = [];
10728
- for (const child of element.flowElements ?? []) {
10729
- result.push(child, ...allFlowElements(child));
10730
- }
10731
- return result;
10732
- }
10733
- var CONNECTION_CONNECTOR_TYPES = new Set([
10734
- "Intsvc.ActivityExecution",
10735
- "Intsvc.EventTrigger",
10736
- "Intsvc.WaitForEvent"
10737
- ]);
10738
- var EXTERNAL_EXECUTION_TYPES = new Set([
10739
- "Intsvc.AsyncExecution",
10740
- "Intsvc.SyncAgentExecution",
10741
- "Intsvc.AsyncAgentExecution",
10742
- "Intsvc.AsyncWorkflowExecution",
10743
- "Intsvc.SyncWorkflowExecution"
10744
- ]);
10745
- var BINDING_NODE_TYPES = new Set([
10746
- ...CONNECTION_CONNECTOR_TYPES,
10747
- ...EXTERNAL_EXECUTION_TYPES,
10748
- "Intsvc.UnifiedHttpRequest"
10749
- ]);
10750
- function connectorNodes(process, types = CONNECTION_CONNECTOR_TYPES) {
10751
- return allFlowElements(process).flatMap((element) => {
10752
- const payload = extensionValues(element).find((node) => node.$type === "uipath:activity" || node.$type === "uipath:event");
10753
- const extensionType = childNodes(payload).find((node) => node.$type === "uipath:type")?.value;
10754
- if (extensionType === undefined || !types.has(extensionType)) {
10755
- return [];
10756
- }
10757
- const context = childNodes(payload).find((node) => node.$type === "uipath:context");
10758
- const values = new Map([...childNodes(context), ...childNodes(payload)].filter((node) => node.$type === "uipath:input" && node.name).map((node) => [
10759
- node.name,
10760
- node.value ?? node.$body
10761
- ]));
10762
- return [{ element, extensionType, values }];
10763
- });
10764
- }
10765
- var connectionReference = (values) => [values.get("connection"), values.get("connectionId")].find((value) => value?.trim());
10766
- var bindingIdOf = (value) => /^=bindings\.([A-Za-z_][\w.-]*)$/.exec(value ?? "")?.[1];
10767
- var rootBindingNodes = (process) => childNodes(extensionValues(process).find((node) => node.$type === "uipath:bindings")).filter((node) => node.$type === "uipath:binding");
10768
- var connectionBindingNodes = (process) => rootBindingNodes(process).filter((node) => node.resource === "Connection" && node.propertyAttribute === "ConnectionId");
10769
-
10770
10838
  // src/bpmn-packaging/connection-resources.ts
10771
10839
  function targetConnectorOf(body) {
10772
10840
  if (!body?.trim())
@@ -11062,14 +11130,17 @@ function buildBindingResources(processes, existingResources) {
11062
11130
  }
11063
11131
  }
11064
11132
  }
11065
- for (const resource of buildEntityResources(processes)) {
11133
+ for (const resource of [
11134
+ ...buildEntityResources(processes),
11135
+ ...buildBusinessRuleResources(processes)
11136
+ ]) {
11066
11137
  const id = resourceIdentity(resource);
11067
11138
  if (!generated.has(id))
11068
11139
  generated.set(id, resource);
11069
11140
  }
11070
11141
  const declared = declaredResourceKeys(processes);
11071
11142
  const sdkEntities = sdkEntityKeys(processes);
11072
- const merged = withConnections.filter((resource) => !isRebuiltRow(resource) || generated.has(resourceIdentity(resource)) || isScopedRow(resource) && declared.has(String(resource.key)) && !(resource.resource === "Entity" && sdkEntities.has(String(resource.key)))).map((resource) => {
11143
+ const merged = withConnections.filter((resource) => !isRebuiltRow(resource) || generated.has(resourceIdentity(resource)) || isScopedRow(resource) && declared.has(String(resource.key)) && resource.resource !== BUSINESS_RULE_RESOURCE && !(resource.resource === "Entity" && sdkEntities.has(String(resource.key)))).map((resource) => {
11073
11144
  const id = resourceIdentity(resource);
11074
11145
  const replacement = generated.get(id);
11075
11146
  if (replacement === undefined)
@@ -11081,8 +11152,9 @@ function buildBindingResources(processes, existingResources) {
11081
11152
  }
11082
11153
  var resourceIdentity = (resource) => `${String(resource.resource)}|${String(resource.key)}`;
11083
11154
  function isRebuiltRow(resource) {
11084
- if (resource.resource === "EventTrigger")
11155
+ if (resource.resource === "EventTrigger" || resource.resource === BUSINESS_RULE_RESOURCE) {
11085
11156
  return true;
11157
+ }
11086
11158
  const metadata = isJsonObject(resource.metadata) ? resource.metadata : undefined;
11087
11159
  if (typeof metadata?.NameFieldPath === "string")
11088
11160
  return true;
@@ -17361,4 +17433,4 @@ export {
17361
17433
  required
17362
17434
  };
17363
17435
 
17364
- //# debugId=A913D2BAA055828564756E2164756E21
17436
+ //# debugId=1959DC5612DC06EF64756E2164756E21
@@ -1121,7 +1121,7 @@ var init_package = __esm(() => {
1121
1121
  name: "@uipath/integrationservice-sdk",
1122
1122
  author: "UiPath",
1123
1123
  license: "SEE LICENSE IN LICENSE.txt",
1124
- version: "1.207.0-preview.327",
1124
+ version: "1.207.0-preview.328",
1125
1125
  repository: {
1126
1126
  type: "git",
1127
1127
  url: "https://github.com/UiPath/cli.git",
@@ -265184,4 +265184,4 @@ export {
265184
265184
  studioCatalogTypeCache
265185
265185
  };
265186
265186
 
265187
- //# debugId=7493A832B80836DF64756E2164756E21
265187
+ //# debugId=FB2957E5ACAB3F3964756E2164756E21
package/dist/index.js CHANGED
@@ -144975,7 +144975,7 @@ var init_package = __esm(() => {
144975
144975
  name: "@uipath/integrationservice-sdk",
144976
144976
  author: "UiPath",
144977
144977
  license: "SEE LICENSE IN LICENSE.txt",
144978
- version: "1.207.0-preview.327",
144978
+ version: "1.207.0-preview.328",
144979
144979
  repository: {
144980
144980
  type: "git",
144981
144981
  url: "https://github.com/UiPath/cli.git",
@@ -288653,4 +288653,4 @@ export {
288653
288653
  withPimsCall
288654
288654
  };
288655
288655
 
288656
- //# debugId=95328330B276CA0064756E2164756E21
288656
+ //# debugId=59DFB2525E8EE8EC64756E2164756E21
@@ -144811,7 +144811,7 @@ var init_package = __esm(() => {
144811
144811
  name: "@uipath/integrationservice-sdk",
144812
144812
  author: "UiPath",
144813
144813
  license: "SEE LICENSE IN LICENSE.txt",
144814
- version: "1.207.0-preview.327",
144814
+ version: "1.207.0-preview.328",
144815
144815
  repository: {
144816
144816
  type: "git",
144817
144817
  url: "https://github.com/UiPath/cli.git",
@@ -264760,4 +264760,4 @@ export {
264760
264760
  shownRows
264761
264761
  };
264762
264762
 
264763
- //# debugId=B10224E86F70374164756E2164756E21
264763
+ //# debugId=B763021A4ABD841F64756E2164756E21
@@ -30482,4 +30482,4 @@ export {
30482
30482
  splitProcessKey
30483
30483
  };
30484
30484
 
30485
- //# debugId=10B7A02215AAF09964756E2164756E21
30485
+ //# debugId=04F272A0713B086D64756E2164756E21
@@ -7,8 +7,10 @@ import type { BpmnNode } from "./types.js";
7
7
  * its pickers bound and its Property bag), as Studio Web packages them
8
8
  * (PO.Frontend `getBindingResources`), plus an `Entity` row for each
9
9
  * folder-scoped entity a V1 Data Service task names through the builder SDK's
10
- * `Entity` binding pair (`buildEntityResources`). Those trigger, picker and Property
11
- * rows are rebuilt from the process each time, so an old one nothing produced
12
- * now is dropped; entries none of these manage are kept.
10
+ * `Entity` binding pair (`buildEntityResources`), and a `BusinessRule` row for
11
+ * each rule a business-rule task runs (`buildBusinessRuleResources`). Those
12
+ * trigger, picker, Property and business-rule rows are rebuilt from the process
13
+ * each time, so an old one nothing produced now is dropped; entries none of
14
+ * these manage are kept.
13
15
  */
14
16
  export declare function buildBindingResources(processes: BpmnNode[], existingResources: JsonObject[]): JsonObject[];
@@ -0,0 +1,18 @@
1
+ import type { JsonObject } from "./package-metadata.js";
2
+ import type { BpmnNode } from "./types.js";
3
+ /** The `bindings_v2.json` resource type of a business rule. */
4
+ export declare const BUSINESS_RULE_RESOURCE = "BusinessRule";
5
+ /**
6
+ * The `BusinessRule` rows for the rules the process's business-rule tasks run.
7
+ *
8
+ * A business-rule task (`Orchestrator.BusinessRules`, which the builder SDK
9
+ * writes for `.businessRule()`) names its rule through two root bindings,
10
+ * `resource="BusinessRule"`, `propertyAttribute` `name` and `folderPath`, one
11
+ * `resourceKey`, and its `name` / `folderPath` context inputs point at them.
12
+ * Studio Web packages one row per rule (resource key) whose name binding a
13
+ * node references, with the folder folded into its value (PO.Frontend
14
+ * `getBindingResources`, root-binding pass). A binding no task references gets
15
+ * no row. In a diagram with pools the bindings sit on the collaboration, so
16
+ * those count as the process's own.
17
+ */
18
+ export declare function buildBusinessRuleResources(processes: BpmnNode[]): JsonObject[];
@@ -42,5 +42,11 @@ export declare const connectionReference: (values: ReadonlyMap<string, string |
42
42
  export declare const bindingIdOf: (value: string | undefined) => string | undefined;
43
43
  /** The process's root `<uipath:binding>` entries. */
44
44
  export declare const rootBindingNodes: (process: BpmnNode) => UiPathNode[];
45
+ /**
46
+ * The root bindings on the collaborations beside the process. With pools in
47
+ * the diagram, Studio Web writes the root bindings on `bpmn:Collaboration`
48
+ * instead of the process (PO.Frontend `parent-element.ts` serializer).
49
+ */
50
+ export declare const collaborationBindingNodes: (process: BpmnNode) => UiPathNode[];
45
51
  /** The process's root `Connection` / `ConnectionId` bindings. */
46
52
  export declare const connectionBindingNodes: (process: BpmnNode) => UiPathNode[];
@@ -35,4 +35,6 @@ export interface BpmnNode {
35
35
  extensionElements?: {
36
36
  values?: UiPathNode[];
37
37
  };
38
+ /** The containing element bpmn-moddle sets on parse (a process's is its definitions). */
39
+ $parent?: BpmnNode;
38
40
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/maestro-sdk",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.207.0-preview.327",
5
+ "version": "1.207.0-preview.328",
6
6
  "description": "SDK for the UiPath Maestro (PIMS) API — process instance management.",
7
7
  "repository": {
8
8
  "type": "git",
@@ -113,5 +113,5 @@
113
113
  "files": [
114
114
  "dist"
115
115
  ],
116
- "gitHead": "c60603941b8ddfa3c8b49502a43eb4474d1f6d08"
116
+ "gitHead": "c647aa45035d66e167006b621a5115ed05d95d65"
117
117
  }