@uipath/maestro-builder-sdk 6.120.29 → 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: 1000 } } } : metadata;
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,
@@ -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";
@@ -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.29",
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": "b9f4e3a5ecb624b793b0158eb99d7dae5a70b532"
127
+ "gitref": "f9d00984ecab561a938be316f4b7a6070b2e78cb"
128
128
  }