@uipath/maestro-builder-sdk 6.93.1 → 6.93.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.
@@ -917,6 +917,28 @@ function savedConfiguration(context) {
917
917
  return undefined;
918
918
  }
919
919
  }
920
+ /**
921
+ * The activity type the task was saved against (`Curated`, ...): the saved
922
+ * configuration's `instanceParameters.activityType`, else the activity
923
+ * metadata's. It picks between a curated activity and the generic one on the
924
+ * same object and path (`Library.identifyAction`).
925
+ */
926
+ function connectorActivityType(context) {
927
+ const fromConfig = savedConfiguration(context)?.essentialConfiguration?.instanceParameters?.activityType;
928
+ if (typeof fromConfig === 'string' && fromConfig)
929
+ return fromConfig;
930
+ let activity = context.get('metadata')?.body?.activityMetadata?.activity?.configuration;
931
+ if (typeof activity === 'string') {
932
+ try {
933
+ activity = JSON.parse(activity);
934
+ }
935
+ catch {
936
+ return undefined;
937
+ }
938
+ }
939
+ const fromActivity = activity?.activityType;
940
+ return typeof fromActivity === 'string' && fromActivity ? fromActivity : undefined;
941
+ }
920
942
  function connectorVersion(context) {
921
943
  const metadata = context.get('metadata')?.body;
922
944
  const encoded = metadata?.activityPropertyConfiguration?.configuration;
@@ -1057,6 +1079,7 @@ function connectorCall(task, refs, library) {
1057
1079
  endpoint: String(endpoint),
1058
1080
  objectName: String(objectName),
1059
1081
  version: connectorVersion(context),
1082
+ activityType: connectorActivityType(context),
1060
1083
  });
1061
1084
  const fromLibrary = library.resolve(identity.key, identity.action, identity.version, identity.object);
1062
1085
  // The fields the plan's saved field list declares and the library lacks: a
@@ -1155,6 +1178,7 @@ function externalCall(task, refs, library) {
1155
1178
  endpoint: stringValue('path'),
1156
1179
  objectName: stringValue('objectName'),
1157
1180
  version: connectorVersion(context),
1181
+ activityType: connectorActivityType(context),
1158
1182
  });
1159
1183
  const resolved = library.resolve(identity.key, identity.action, identity.version, identity.object);
1160
1184
  const refused = externalDescriptorRefusal(kind, resolved);
@@ -79,6 +79,22 @@
79
79
  * records the body parameter.
80
80
  */
81
81
  export declare function buildConfiguration(entry: any, version: string, inputValues?: Record<string, unknown>, seed?: string, executionType?: string | null): string;
82
+ /**
83
+ * The `instanceParameters.activityType` compile writes for a library entry's
84
+ * `operation.activityType`: `Generic` for a generic CRUD entry (`Generic`,
85
+ * `GenericExpanded`), else `Curated`. Studio Web saves the same two values.
86
+ * `wireActivityTypeMatches` is its inverse; keep the two together.
87
+ */
88
+ export declare function wireActivityType(libraryActivityType: unknown): 'Generic' | 'Curated';
89
+ /**
90
+ * Whether a library entry with `operation.activityType` `libraryActivityType`
91
+ * is one compile would save with the wire `activityType` `wire`: the inverse
92
+ * of `wireActivityType`. For instance a `GenericExpanded` entry matches a
93
+ * saved `"Generic"`, and a `Curated` one a saved `"Curated"`. A wire value
94
+ * that is neither (`GenericExpanded` read off an older plan reads as
95
+ * `Generic`) names no entry kind.
96
+ */
97
+ export declare function wireActivityTypeMatches(libraryActivityType: unknown, wire: string): boolean;
82
98
  /**
83
99
  * The `essentialConfiguration` object that {@link buildConfiguration} wraps in
84
100
  * its `=jsonString:` envelope. For a caller that also needs a field of it (Case
@@ -190,6 +190,27 @@ export function buildConfiguration(entry, version, inputValues, seed = 'node', e
190
190
  essentialConfiguration: buildEssentialConfiguration(entry, version, inputValues, seed, executionType),
191
191
  });
192
192
  }
193
+ /**
194
+ * The `instanceParameters.activityType` compile writes for a library entry's
195
+ * `operation.activityType`: `Generic` for a generic CRUD entry (`Generic`,
196
+ * `GenericExpanded`), else `Curated`. Studio Web saves the same two values.
197
+ * `wireActivityTypeMatches` is its inverse; keep the two together.
198
+ */
199
+ export function wireActivityType(libraryActivityType) {
200
+ return libraryActivityType === 'Generic' || libraryActivityType === 'GenericExpanded' ? 'Generic' : 'Curated';
201
+ }
202
+ /**
203
+ * Whether a library entry with `operation.activityType` `libraryActivityType`
204
+ * is one compile would save with the wire `activityType` `wire`: the inverse
205
+ * of `wireActivityType`. For instance a `GenericExpanded` entry matches a
206
+ * saved `"Generic"`, and a `Curated` one a saved `"Curated"`. A wire value
207
+ * that is neither (`GenericExpanded` read off an older plan reads as
208
+ * `Generic`) names no entry kind.
209
+ */
210
+ export function wireActivityTypeMatches(libraryActivityType, wire) {
211
+ const kind = wire === 'GenericExpanded' ? 'Generic' : wire;
212
+ return (kind === 'Generic' || kind === 'Curated') && wireActivityType(libraryActivityType) === kind;
213
+ }
193
214
  /**
194
215
  * The `essentialConfiguration` object that {@link buildConfiguration} wraps in
195
216
  * its `=jsonString:` envelope. For a caller that also needs a field of it (Case
@@ -206,9 +227,8 @@ export function buildConfiguration(entry, version, inputValues, seed = 'node', e
206
227
  export function buildEssentialConfiguration(entry, version, inputValues, seed = 'node', executionType = null) {
207
228
  const op = entry.operation ?? {};
208
229
  const conn = entry.connector ?? {};
209
- const at = op.activityType;
210
- const isGeneric = at === 'Generic' || at === 'GenericExpanded';
211
- const v1ActivityType = isGeneric ? 'Generic' : 'Curated';
230
+ const v1ActivityType = wireActivityType(op.activityType);
231
+ const isGeneric = v1ActivityType === 'Generic';
212
232
  // `operation.name` is the verb (`List`, `Create`, …); the platform stores it
213
233
  // lower-cased. Falls back to the default `create` for an entry that declares no
214
234
  // name, which keeps such an entry's emission exactly as it was.
@@ -336,6 +336,16 @@ export declare class Library {
336
336
  * `GETBYID` goes on the wire as `GET`. So an entry matches on its transport
337
337
  * verb too, after an exact match: Outlook `download-email-attachment`
338
338
  * (`GETBYID /DownloadAttachment`) is saved as `GET /DownloadAttachment`.
339
+ *
340
+ * One object often has two entries with the same verb and path: the curated
341
+ * activity and the generic CRUD one (Outlook `send-email`, `Curated`, and
342
+ * `insert-record-deprecated-`, `GenericExpanded`, both `POST
343
+ * /hubs/productivity/send-mail-v2`). The wire's `activityType` (the saved
344
+ * `instanceParameters.activityType`) says which one the plan was saved
345
+ * against: `Curated` or `Generic`, as compile writes it from the entry's
346
+ * `operation.activityType` (`wireActivityType`; a `GenericExpanded` entry is
347
+ * saved as `Generic`). An entry of that kind wins; without one, the first
348
+ * match in library order does.
339
349
  */
340
350
  identifyAction(wire: {
341
351
  connectorKey: string;
@@ -343,6 +353,7 @@ export declare class Library {
343
353
  endpoint?: string;
344
354
  objectName?: string;
345
355
  version?: string;
356
+ activityType?: string;
346
357
  }): ConnectorActionIdentity;
347
358
  /**
348
359
  * Resolve a connector EVENT: the START trigger
@@ -16,6 +16,7 @@ import { ownEntry } from './own-entry.js';
16
16
  import { ConnectorResolveError } from './connector-resolve-error.js';
17
17
  import { CompileRefusal } from './compile-refusal.js';
18
18
  import { transportHttpMethod } from './connector-inputs.js';
19
+ import { wireActivityTypeMatches } from './connector-configuration.js';
19
20
  export { ConnectorResolveError } from './connector-resolve-error.js';
20
21
  export class Library {
21
22
  layers = [];
@@ -272,6 +273,16 @@ export class Library {
272
273
  * `GETBYID` goes on the wire as `GET`. So an entry matches on its transport
273
274
  * verb too, after an exact match: Outlook `download-email-attachment`
274
275
  * (`GETBYID /DownloadAttachment`) is saved as `GET /DownloadAttachment`.
276
+ *
277
+ * One object often has two entries with the same verb and path: the curated
278
+ * activity and the generic CRUD one (Outlook `send-email`, `Curated`, and
279
+ * `insert-record-deprecated-`, `GenericExpanded`, both `POST
280
+ * /hubs/productivity/send-mail-v2`). The wire's `activityType` (the saved
281
+ * `instanceParameters.activityType`) says which one the plan was saved
282
+ * against: `Curated` or `Generic`, as compile writes it from the entry's
283
+ * `operation.activityType` (`wireActivityType`; a `GenericExpanded` entry is
284
+ * saved as `Generic`). An entry of that kind wins; without one, the first
285
+ * match in library order does.
275
286
  */
276
287
  identifyAction(wire) {
277
288
  const prefix = `uipath.connector.${wire.connectorKey}.`;
@@ -279,32 +290,40 @@ export class Library {
279
290
  const upper = String(method ?? '').toUpperCase();
280
291
  return transport ? transportHttpMethod(upper) : upper;
281
292
  };
282
- // Exact verbs first, so an entry the wire names exactly wins over a transport twin.
283
- for (const transport of [false, true]) {
284
- for (const layer of this.layers) {
285
- for (const indexed of layer.entries) {
286
- if (indexed.connectorKey !== wire.connectorKey || !String(indexed.nodeType ?? '').startsWith(prefix))
287
- continue;
288
- if (wire.version && indexed.version !== wire.version)
289
- continue;
290
- const entry = readJson(this.read, libraryPath(layer.dir, indexed.path));
291
- const operation = entry.operation ?? {};
292
- if (wire.httpMethod && verb(operation.httpMethod, transport) !== verb(wire.httpMethod, transport))
293
- continue;
294
- if (wire.endpoint && operation.path !== wire.endpoint)
295
- continue;
296
- if (wire.objectName && operation.objectName !== wire.objectName)
297
- continue;
298
- const siblings = layer.entries.filter((candidate) => candidate.nodeType === indexed.nodeType);
299
- return {
300
- key: wire.connectorKey,
301
- action: String(indexed.nodeType).slice(prefix.length),
302
- version: String(indexed.version),
303
- ...(siblings.length > 1 && operation.objectName ? { object: String(operation.objectName) } : {}),
304
- };
293
+ // The wire's activityType first, then any; exact verbs first within each,
294
+ // so an entry the wire names exactly wins over a transport twin.
295
+ const kinds = wire.activityType ? [wire.activityType, undefined] : [undefined];
296
+ for (const kind of kinds)
297
+ for (const transport of [false, true]) {
298
+ for (const layer of this.layers) {
299
+ for (const indexed of layer.entries) {
300
+ if (indexed.connectorKey !== wire.connectorKey || !String(indexed.nodeType ?? '').startsWith(prefix))
301
+ continue;
302
+ if (wire.version && indexed.version !== wire.version)
303
+ continue;
304
+ // The index row carries the entry's activityType: filter on it before parsing the entry.
305
+ if (kind !== undefined && indexed.activityType !== undefined && !wireActivityTypeMatches(indexed.activityType, kind))
306
+ continue;
307
+ const entry = readJson(this.read, libraryPath(layer.dir, indexed.path));
308
+ const operation = entry.operation ?? {};
309
+ if (kind !== undefined && indexed.activityType === undefined && !wireActivityTypeMatches(operation.activityType, kind))
310
+ continue;
311
+ if (wire.httpMethod && verb(operation.httpMethod, transport) !== verb(wire.httpMethod, transport))
312
+ continue;
313
+ if (wire.endpoint && operation.path !== wire.endpoint)
314
+ continue;
315
+ if (wire.objectName && operation.objectName !== wire.objectName)
316
+ continue;
317
+ const siblings = layer.entries.filter((candidate) => candidate.nodeType === indexed.nodeType);
318
+ return {
319
+ key: wire.connectorKey,
320
+ action: String(indexed.nodeType).slice(prefix.length),
321
+ version: String(indexed.version),
322
+ ...(siblings.length > 1 && operation.objectName ? { object: String(operation.objectName) } : {}),
323
+ };
324
+ }
305
325
  }
306
326
  }
307
- }
308
327
  throw new CompileRefusal('CONNECTOR_NOT_IN_LIBRARY', `connector activity not found in library: ${wire.connectorKey} ${wire.httpMethod ?? '?'} ${wire.endpoint ?? '?'}`);
309
328
  }
310
329
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.93.1",
3
+ "version": "6.93.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",
@@ -111,5 +111,5 @@
111
111
  "@types/node": "^22.7.0",
112
112
  "esbuild": "^0.28.1"
113
113
  },
114
- "gitref": "f4ab3ce258d87a754bc38d9f4e07af1498216211"
114
+ "gitref": "4bc011b67ec4912b299602a55fe26ef6e41b382d"
115
115
  }