@uipath/maestro-builder-sdk 6.120.28 → 6.120.30
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.
|
@@ -208,7 +208,9 @@ export interface DataServiceWire {
|
|
|
208
208
|
* @returns The wire shape, without the connection/folder wiring the builder adds.
|
|
209
209
|
* @throws CompileRefusal for a folder-scoped entity on a file operation (`BPMN_DATA_SERVICE_FOLDER_FILE_OP`), or one with no name
|
|
210
210
|
* (`BPMN_DATA_SERVICE_ENTITY_NO_NAME`), no folder key (`BPMN_DATA_SERVICE_FOLDER_KEY_MISSING`) or a folder key that is not a
|
|
211
|
-
* key (`BPMN_DATA_SERVICE_FOLDER_KEY_NOT_GUID`)
|
|
211
|
+
* key (`BPMN_DATA_SERVICE_FOLDER_KEY_NOT_GUID`); for a query whose literal `start` is not a whole number from 0
|
|
212
|
+
* (`BPMN_DATA_SERVICE_QUERY_START_INVALID`) or whose literal `limit` is not one from 1 to 1000
|
|
213
|
+
* (`BPMN_DATA_SERVICE_QUERY_LIMIT_INVALID`).
|
|
212
214
|
*/
|
|
213
215
|
export declare function dataServiceWire(entity: string | DataServiceFolderEntity, operation: DataServiceOperation): DataServiceWire;
|
|
214
216
|
/**
|
|
@@ -24,7 +24,9 @@ export function isFolderEntity(entity) {
|
|
|
24
24
|
* @returns The wire shape, without the connection/folder wiring the builder adds.
|
|
25
25
|
* @throws CompileRefusal for a folder-scoped entity on a file operation (`BPMN_DATA_SERVICE_FOLDER_FILE_OP`), or one with no name
|
|
26
26
|
* (`BPMN_DATA_SERVICE_ENTITY_NO_NAME`), no folder key (`BPMN_DATA_SERVICE_FOLDER_KEY_MISSING`) or a folder key that is not a
|
|
27
|
-
* key (`BPMN_DATA_SERVICE_FOLDER_KEY_NOT_GUID`)
|
|
27
|
+
* key (`BPMN_DATA_SERVICE_FOLDER_KEY_NOT_GUID`); for a query whose literal `start` is not a whole number from 0
|
|
28
|
+
* (`BPMN_DATA_SERVICE_QUERY_START_INVALID`) or whose literal `limit` is not one from 1 to 1000
|
|
29
|
+
* (`BPMN_DATA_SERVICE_QUERY_LIMIT_INVALID`).
|
|
28
30
|
*/
|
|
29
31
|
export function dataServiceWire(entity, operation) {
|
|
30
32
|
if (typeof entity !== 'string')
|
|
@@ -185,7 +187,7 @@ function dataServiceMetadata(catalog, slots) {
|
|
|
185
187
|
connectorName: DATA_SERVICE_CONNECTOR_NAME,
|
|
186
188
|
}, operation, slots, catalog.objectName);
|
|
187
189
|
// A list operation's paging, as Studio Web saves the query (`maxPageSize` is the connector's).
|
|
188
|
-
return catalog.verb === 'list' ? { ...metadata, inputMetadata: { operation: 'list', pagination: { maxPageSize:
|
|
190
|
+
return catalog.verb === 'list' ? { ...metadata, inputMetadata: { operation: 'list', pagination: { maxPageSize: QUERY_PAGE_CAP } } } : metadata;
|
|
189
191
|
}
|
|
190
192
|
/**
|
|
191
193
|
* The five curated record operations, from `uip maestro bpmn registry get
|
|
@@ -237,6 +239,24 @@ const FOLDER_OPERATIONS = {
|
|
|
237
239
|
};
|
|
238
240
|
/** A folder key: a GUID, as `uip or folders list` returns it. */
|
|
239
241
|
const GUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
242
|
+
/** The most records one query page returns: the connector's `maxPageSize`. */
|
|
243
|
+
const QUERY_PAGE_CAP = 1000;
|
|
244
|
+
const isExpression = (value) => typeof value === 'string' && value.length > 1 && value.startsWith('=');
|
|
245
|
+
const shown = (value) => (typeof value === 'string' ? JSON.stringify(value) : String(value));
|
|
246
|
+
/**
|
|
247
|
+
* Refuse a query `start` or `limit` the connector cannot page with. The type stops a
|
|
248
|
+
* TypeScript author; this stops a JS author or a cast. A `limit` over the cap returns at
|
|
249
|
+
* most the cap, so a "page until a short page" loop ends after one page.
|
|
250
|
+
*/
|
|
251
|
+
function validateQueryPaging(operation) {
|
|
252
|
+
const { start, limit } = operation;
|
|
253
|
+
if (start !== undefined && !isExpression(start) && !(Number.isSafeInteger(start) && start >= 0)) {
|
|
254
|
+
throw new CompileRefusal('BPMN_DATA_SERVICE_QUERY_START_INVALID', `dataService: query start ${shown(start)} is not a record offset. It takes a whole number from 0, or an =-expression ('=vars.pageStart').`);
|
|
255
|
+
}
|
|
256
|
+
if (limit !== undefined && !isExpression(limit) && !(Number.isSafeInteger(limit) && limit >= 1 && limit <= QUERY_PAGE_CAP)) {
|
|
257
|
+
throw new CompileRefusal('BPMN_DATA_SERVICE_QUERY_LIMIT_INVALID', `dataService: query limit ${shown(limit)} is not a page size. It takes a whole number from 1 to ${QUERY_PAGE_CAP}, the connector's page cap, or an =-expression ('=vars.pageSize').`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
240
260
|
/**
|
|
241
261
|
* Refuse a folder-scoped entity whose name or folder key cannot be right, at the
|
|
242
262
|
* call that wrote it. The folder key is the trap: the connector's `describe` labels
|
|
@@ -288,6 +308,7 @@ function folderEntityWire(entity, operation) {
|
|
|
288
308
|
case 'get':
|
|
289
309
|
return wire([scalarRow('recordId', 'query', operation.recordId), ...optionalRow('expansionLevel', 'query', operation.expansionLevel)]);
|
|
290
310
|
case 'query':
|
|
311
|
+
validateQueryPaging(operation);
|
|
291
312
|
return wire([
|
|
292
313
|
...optionalRow('queryExpression', 'query', operation.where),
|
|
293
314
|
scalarRow('start', 'query', operation.start ?? 0),
|
|
@@ -326,6 +347,7 @@ function recordWire(entity, operation) {
|
|
|
326
347
|
query = defined({ recordId: operation.recordId, expansionLevel: operation.expansionLevel });
|
|
327
348
|
break;
|
|
328
349
|
case 'query':
|
|
350
|
+
validateQueryPaging(operation);
|
|
329
351
|
query = defined({
|
|
330
352
|
queryExpression: operation.where,
|
|
331
353
|
start: operation.start ?? 0,
|
package/dist/case/serialize.js
CHANGED
|
@@ -1417,9 +1417,24 @@ function restoreTaskEntryShape(task, wanted) {
|
|
|
1417
1417
|
* held by one, so the rows take theirs together: the ids are released, then
|
|
1418
1418
|
* claimed. A chain that ends at a row with no claim (an id the source does not
|
|
1419
1419
|
* carry for it) still waits, and its rows keep the ids compile gave them.
|
|
1420
|
+
*
|
|
1421
|
+
* A claim whose id a settled row holds never succeeds: the source saved that
|
|
1422
|
+
* id on two rows (validate's `CASE_MGMT_OUTPUT_ID_DUPLICATE`), and the first
|
|
1423
|
+
* keeps it. When another claim waits for the id such a row holds, the row
|
|
1424
|
+
* gives it up and gets a fresh one (`remint`, once no claim moves any more).
|
|
1425
|
+
* A plan saved with three writers of `flag`,
|
|
1426
|
+
*
|
|
1427
|
+
* A `flag`, B `flag` (the repeat), C `flag2`
|
|
1428
|
+
*
|
|
1429
|
+
* compiles as `flag`, `flag2`, `flag3`: B can never take `flag`, so it moves
|
|
1430
|
+
* off `flag2`, C takes `flag2`, and B gets `flag3`, an id no saved row holds.
|
|
1420
1431
|
*/
|
|
1421
|
-
function settleDeferredClaims(deferred, held, claim) {
|
|
1432
|
+
function settleDeferredClaims(deferred, held, claim, remint) {
|
|
1422
1433
|
let pending = deferred;
|
|
1434
|
+
// Rows that gave up the id compile wrote them with, to remint at the end.
|
|
1435
|
+
const vacated = [];
|
|
1436
|
+
const settle = () => { for (const target of vacated)
|
|
1437
|
+
remint(target); };
|
|
1423
1438
|
while (pending.length) {
|
|
1424
1439
|
const next = pending.filter(({ target, row }) => !claim(target, row));
|
|
1425
1440
|
if (next.length < pending.length) {
|
|
@@ -1428,6 +1443,16 @@ function settleDeferredClaims(deferred, held, claim) {
|
|
|
1428
1443
|
}
|
|
1429
1444
|
// Stuck: find a ring of claims, each wanting the id the next one holds.
|
|
1430
1445
|
const byHeldId = new Map(pending.map((entry) => [entry.target?.id, entry]));
|
|
1446
|
+
// A claim on an id a settled row holds, whose own id another claim waits for.
|
|
1447
|
+
const wanted = new Set(pending.map((entry) => entry.row.id));
|
|
1448
|
+
const dead = pending.find((entry) => !vacated.includes(entry.target) && !byHeldId.has(entry.row.id)
|
|
1449
|
+
&& typeof entry.target?.id === 'string' && wanted.has(entry.target.id));
|
|
1450
|
+
if (dead) {
|
|
1451
|
+
held.delete(dead.target.id);
|
|
1452
|
+
vacated.push(dead.target);
|
|
1453
|
+
pending = pending.filter((entry) => entry !== dead);
|
|
1454
|
+
continue;
|
|
1455
|
+
}
|
|
1431
1456
|
let ring;
|
|
1432
1457
|
for (const start of pending) {
|
|
1433
1458
|
const path = [];
|
|
@@ -1440,7 +1465,7 @@ function settleDeferredClaims(deferred, held, claim) {
|
|
|
1440
1465
|
}
|
|
1441
1466
|
}
|
|
1442
1467
|
if (!ring)
|
|
1443
|
-
return;
|
|
1468
|
+
return settle();
|
|
1444
1469
|
for (const { target } of ring)
|
|
1445
1470
|
held.delete(target.id);
|
|
1446
1471
|
// `claimRowId` frees the id the row held when it moves; in a ring that id
|
|
@@ -1452,6 +1477,7 @@ function settleDeferredClaims(deferred, held, claim) {
|
|
|
1452
1477
|
held.add(target.id);
|
|
1453
1478
|
pending = pending.filter((entry) => !ring.includes(entry));
|
|
1454
1479
|
}
|
|
1480
|
+
settle();
|
|
1455
1481
|
}
|
|
1456
1482
|
function applyPreservedIdentities(result, preservation, warn) {
|
|
1457
1483
|
const identities = preservation.identities;
|
|
@@ -1967,7 +1993,48 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1967
1993
|
for (const row of droppedConnectorOutputRows(result, preservation.connectorRows, finalVar))
|
|
1968
1994
|
if (typeof row.id === 'string')
|
|
1969
1995
|
heldOutputIds.delete(row.id);
|
|
1970
|
-
|
|
1996
|
+
// A fresh id for a row that gave up its compiled id (`settleDeferredClaims`):
|
|
1997
|
+
// the next free suffix of its variable that no row holds and no saved row
|
|
1998
|
+
// carries, so it reads as compile's repair of the repeat, not a saved id. A
|
|
1999
|
+
// row that is its own variable (a connector's `response7`) is numbered from
|
|
2000
|
+
// the id's stem (`response`), as compile numbers it. Like compile's own
|
|
2001
|
+
// allocator (`caseVarNames`), it never takes the name of a case variable or
|
|
2002
|
+
// of a variable another row writes: an own row's `var` follows its id, so
|
|
2003
|
+
// that would redirect the row into that variable.
|
|
2004
|
+
const carriedOutputIds = new Set();
|
|
2005
|
+
const collectCarried = (value, key = '') => {
|
|
2006
|
+
if (Array.isArray(value)) {
|
|
2007
|
+
for (const item of value) {
|
|
2008
|
+
if (key === 'outputs' && typeof item?.id === 'string')
|
|
2009
|
+
carriedOutputIds.add(item.id);
|
|
2010
|
+
collectCarried(item, key);
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
else if (value && typeof value === 'object')
|
|
2014
|
+
for (const [k, v] of Object.entries(value))
|
|
2015
|
+
collectCarried(v, k);
|
|
2016
|
+
};
|
|
2017
|
+
collectCarried(identities);
|
|
2018
|
+
const remint = (target) => {
|
|
2019
|
+
const own = typeof target?.id === 'string' && (target.var === undefined || target.var === target.id);
|
|
2020
|
+
const base = own ? String(target.id).replace(/\d+$/, '') || String(target.id) : String(target.var);
|
|
2021
|
+
const variables = (result.variables ?? {});
|
|
2022
|
+
const reserved = new Set();
|
|
2023
|
+
for (const entry of Object.values(variables).flat())
|
|
2024
|
+
for (const name of [entry?.id, entry?.name])
|
|
2025
|
+
if (typeof name === 'string')
|
|
2026
|
+
reserved.add(name);
|
|
2027
|
+
for (const row of planOutputRows(result, stages))
|
|
2028
|
+
if (row !== target && typeof row?.var === 'string')
|
|
2029
|
+
reserved.add(row.var);
|
|
2030
|
+
const taken = (candidate) => heldOutputIds.has(candidate) || carriedOutputIds.has(candidate) || reserved.has(candidate);
|
|
2031
|
+
let id = `${base}2`;
|
|
2032
|
+
for (let n = 3; taken(id); n++)
|
|
2033
|
+
id = `${base}${n}`;
|
|
2034
|
+
takeRow(target, id, true);
|
|
2035
|
+
heldOutputIds.add(id);
|
|
2036
|
+
};
|
|
2037
|
+
settleDeferredClaims(deferredClaims, heldOutputIds, (target, row) => claimRowId(target, row, target.id), remint);
|
|
1971
2038
|
takeSlas(metadata.slaRules, identities.slaRules);
|
|
1972
2039
|
restoreEmptyLists(metadata, identities.emptyLists, CASE_EMPTY_LISTS);
|
|
1973
2040
|
restoreSlaIds();
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export declare const REFUSALS: {
|
|
|
82
82
|
readonly BPMN_DATA_SERVICE_FOLDER_FILE_OP: "lowering";
|
|
83
83
|
readonly BPMN_DATA_SERVICE_FOLDER_KEY_MISSING: "lowering";
|
|
84
84
|
readonly BPMN_DATA_SERVICE_FOLDER_KEY_NOT_GUID: "lowering";
|
|
85
|
+
readonly BPMN_DATA_SERVICE_QUERY_LIMIT_INVALID: "lowering";
|
|
86
|
+
readonly BPMN_DATA_SERVICE_QUERY_START_INVALID: "lowering";
|
|
85
87
|
readonly BPMN_DUP_BOUNDARY_ID: "lowering";
|
|
86
88
|
readonly BPMN_DUP_ERROR_CATCH: "lowering";
|
|
87
89
|
readonly BPMN_ERROR_NAME_EMPTY: "lowering";
|
package/dist/core/refusals.js
CHANGED
|
@@ -131,6 +131,8 @@ export const REFUSALS = {
|
|
|
131
131
|
BPMN_DATA_SERVICE_FOLDER_FILE_OP: 'lowering',
|
|
132
132
|
BPMN_DATA_SERVICE_FOLDER_KEY_MISSING: 'lowering',
|
|
133
133
|
BPMN_DATA_SERVICE_FOLDER_KEY_NOT_GUID: 'lowering',
|
|
134
|
+
BPMN_DATA_SERVICE_QUERY_LIMIT_INVALID: 'lowering',
|
|
135
|
+
BPMN_DATA_SERVICE_QUERY_START_INVALID: 'lowering',
|
|
134
136
|
BPMN_DUP_BOUNDARY_ID: 'lowering',
|
|
135
137
|
BPMN_DUP_ERROR_CATCH: 'lowering',
|
|
136
138
|
BPMN_ERROR_NAME_EMPTY: 'lowering',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.120.
|
|
3
|
+
"version": "6.120.30",
|
|
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",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"@types/node": "^22.7.0",
|
|
125
125
|
"esbuild": "^0.28.1"
|
|
126
126
|
},
|
|
127
|
-
"gitref": "
|
|
127
|
+
"gitref": "f9d00984ecab561a938be316f4b7a6070b2e78cb"
|
|
128
128
|
}
|