@uipath/data-fabric-tool 1.196.0 → 1.197.0-preview.59

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.
@@ -423,6 +423,7 @@ describe("records get", () => {
423
423
  expect(sdk.entities.getRecordById).toHaveBeenCalledWith(
424
424
  "entity-id",
425
425
  "rec-1",
426
+ undefined,
426
427
  );
427
428
  expect(OutputFormatter.success).toHaveBeenCalledWith(
428
429
  expect.objectContaining({
@@ -527,6 +528,7 @@ describe("records insert", () => {
527
528
  expect(sdk.entities.insertRecordById).toHaveBeenCalledWith(
528
529
  "entity-id",
529
530
  expect.objectContaining({ amount: 100 }),
531
+ undefined,
530
532
  );
531
533
  expect(OutputFormatter.success).toHaveBeenCalledWith(
532
534
  expect.objectContaining({
@@ -578,6 +580,7 @@ describe("records insert", () => {
578
580
  expect.objectContaining({ amount: 100 }),
579
581
  expect.objectContaining({ amount: 200 }),
580
582
  ]),
583
+ undefined,
581
584
  );
582
585
  expect(OutputFormatter.success).toHaveBeenCalledWith(
583
586
  expect.objectContaining({
@@ -702,6 +705,7 @@ describe("records insert", () => {
702
705
  assignee: "AEDE69C3-EFD1-4897-B216-019E1A7E9269",
703
706
  rel1: "B065E2A8-F33B-4721-8228-019DE0C593AF",
704
707
  }),
708
+ undefined,
705
709
  );
706
710
  expect(OutputFormatter.success).toHaveBeenCalledWith(
707
711
  expect.objectContaining({ Code: "RecordInserted" }),
@@ -740,6 +744,7 @@ describe("records insert", () => {
740
744
  assignee: "2481A9F6-E0F7-4996-8446-019E1A7E926A",
741
745
  }),
742
746
  ]),
747
+ undefined,
743
748
  );
744
749
  expect(OutputFormatter.success).toHaveBeenCalledWith(
745
750
  expect.objectContaining({ Code: "RecordsBatchInserted" }),
@@ -806,6 +811,7 @@ describe("records update", () => {
806
811
  "entity-id",
807
812
  "rec-1",
808
813
  expect.objectContaining({ Id: "rec-1", amount: 200 }),
814
+ undefined,
809
815
  );
810
816
  expect(OutputFormatter.success).toHaveBeenCalledWith(
811
817
  expect.objectContaining({
@@ -862,6 +868,7 @@ describe("records update", () => {
862
868
  expect.objectContaining({ Id: "rec-1" }),
863
869
  expect.objectContaining({ Id: "rec-2" }),
864
870
  ]),
871
+ undefined,
865
872
  );
866
873
  expect(OutputFormatter.success).toHaveBeenCalledWith(
867
874
  expect.objectContaining({
@@ -1075,6 +1082,7 @@ describe("records delete", () => {
1075
1082
  expect(sdk.entities.deleteRecordsById).toHaveBeenCalledWith(
1076
1083
  "entity-id",
1077
1084
  ["rec-1", "rec-2"],
1085
+ undefined,
1078
1086
  );
1079
1087
  expect(OutputFormatter.success).toHaveBeenCalledWith(
1080
1088
  expect.objectContaining({
@@ -1187,6 +1195,7 @@ describe("records delete", () => {
1187
1195
  expect(sdk.entities.deleteRecordsById).toHaveBeenCalledWith(
1188
1196
  "entity-id",
1189
1197
  ["rec-1"],
1198
+ undefined,
1190
1199
  );
1191
1200
  expect(OutputFormatter.success).toHaveBeenCalledWith(
1192
1201
  expect.objectContaining({
@@ -1292,6 +1301,7 @@ describe("records insert via --file", () => {
1292
1301
  expect(sdk.entities.insertRecordById).toHaveBeenCalledWith(
1293
1302
  "entity-id",
1294
1303
  expect.objectContaining({ amount: 100 }),
1304
+ undefined,
1295
1305
  );
1296
1306
  expect(OutputFormatter.success).toHaveBeenCalledWith(
1297
1307
  expect.objectContaining({
@@ -1765,6 +1775,7 @@ describe("records import", () => {
1765
1775
  expect(sdk.entities.importRecordsById).toHaveBeenCalledWith(
1766
1776
  "entity-id",
1767
1777
  expect.any(File),
1778
+ undefined,
1768
1779
  );
1769
1780
  expect(OutputFormatter.success).toHaveBeenCalledWith(
1770
1781
  expect.objectContaining({
@@ -2396,3 +2407,228 @@ describe("records — negative scenarios", () => {
2396
2407
  expect(process.exitCode).toBe(1);
2397
2408
  });
2398
2409
  });
2410
+
2411
+ describe("records --folder-key forwarding", () => {
2412
+ beforeEach(() => {
2413
+ vi.resetAllMocks();
2414
+ process.exitCode = undefined;
2415
+ });
2416
+
2417
+ it("should forward --folder-key to getAllRecords on list", async () => {
2418
+ const sdk = mockSdk();
2419
+
2420
+ const program = buildProgram();
2421
+ await program.parseAsync([
2422
+ "node",
2423
+ "test",
2424
+ "records",
2425
+ "list",
2426
+ "entity-id",
2427
+ "--folder-key",
2428
+ "folder-guid-1",
2429
+ ]);
2430
+
2431
+ expect(sdk.entities.getAllRecords).toHaveBeenCalledWith(
2432
+ "entity-id",
2433
+ expect.objectContaining({ folderKey: "folder-guid-1" }),
2434
+ );
2435
+ });
2436
+
2437
+ it("should forward --folder-key to getRecordById on get", async () => {
2438
+ const sdk = mockSdk();
2439
+
2440
+ const program = buildProgram();
2441
+ await program.parseAsync([
2442
+ "node",
2443
+ "test",
2444
+ "records",
2445
+ "get",
2446
+ "entity-id",
2447
+ "rec-1",
2448
+ "--folder-key",
2449
+ "folder-guid-2",
2450
+ ]);
2451
+
2452
+ expect(sdk.entities.getRecordById).toHaveBeenCalledWith(
2453
+ "entity-id",
2454
+ "rec-1",
2455
+ { folderKey: "folder-guid-2" },
2456
+ );
2457
+ });
2458
+
2459
+ it("should forward --folder-key to insertRecordById on single insert", async () => {
2460
+ const sdk = mockSdk();
2461
+
2462
+ const program = buildProgram();
2463
+ await program.parseAsync([
2464
+ "node",
2465
+ "test",
2466
+ "records",
2467
+ "insert",
2468
+ "entity-id",
2469
+ "--body",
2470
+ '{"amount":100}',
2471
+ "--folder-key",
2472
+ "folder-guid-3",
2473
+ ]);
2474
+
2475
+ expect(sdk.entities.insertRecordById).toHaveBeenCalledWith(
2476
+ "entity-id",
2477
+ expect.objectContaining({ amount: 100 }),
2478
+ { folderKey: "folder-guid-3" },
2479
+ );
2480
+ });
2481
+
2482
+ it("should forward --folder-key to insertRecordsById on batch insert", async () => {
2483
+ const sdk = mockSdk();
2484
+
2485
+ const program = buildProgram();
2486
+ await program.parseAsync([
2487
+ "node",
2488
+ "test",
2489
+ "records",
2490
+ "insert",
2491
+ "entity-id",
2492
+ "--body",
2493
+ '[{"amount":100},{"amount":200}]',
2494
+ "--folder-key",
2495
+ "folder-guid-4",
2496
+ ]);
2497
+
2498
+ expect(sdk.entities.insertRecordsById).toHaveBeenCalledWith(
2499
+ "entity-id",
2500
+ expect.any(Array),
2501
+ { folderKey: "folder-guid-4" },
2502
+ );
2503
+ });
2504
+
2505
+ it("should forward --folder-key to updateRecordById on single update", async () => {
2506
+ const sdk = mockSdk();
2507
+
2508
+ const program = buildProgram();
2509
+ await program.parseAsync([
2510
+ "node",
2511
+ "test",
2512
+ "records",
2513
+ "update",
2514
+ "entity-id",
2515
+ "--body",
2516
+ '{"Id":"rec-1","amount":200}',
2517
+ "--folder-key",
2518
+ "folder-guid-5",
2519
+ ]);
2520
+
2521
+ expect(sdk.entities.updateRecordById).toHaveBeenCalledWith(
2522
+ "entity-id",
2523
+ "rec-1",
2524
+ expect.objectContaining({ Id: "rec-1" }),
2525
+ { folderKey: "folder-guid-5" },
2526
+ );
2527
+ });
2528
+
2529
+ it("should forward --folder-key to updateRecordsById on batch update", async () => {
2530
+ const sdk = mockSdk();
2531
+ vi.mocked(sdk.entities.updateRecordsById).mockResolvedValue({
2532
+ successRecords: [{ Id: "rec-1" }, { Id: "rec-2" }],
2533
+ failureRecords: [],
2534
+ });
2535
+
2536
+ const program = buildProgram();
2537
+ await program.parseAsync([
2538
+ "node",
2539
+ "test",
2540
+ "records",
2541
+ "update",
2542
+ "entity-id",
2543
+ "--body",
2544
+ '[{"Id":"rec-1","amount":200},{"Id":"rec-2","amount":300}]',
2545
+ "--folder-key",
2546
+ "folder-guid-8",
2547
+ ]);
2548
+
2549
+ expect(sdk.entities.updateRecordsById).toHaveBeenCalledWith(
2550
+ "entity-id",
2551
+ expect.any(Array),
2552
+ { folderKey: "folder-guid-8" },
2553
+ );
2554
+ });
2555
+
2556
+ it("should forward --folder-key to importRecordsById on import", async () => {
2557
+ const sdk = mockSdk();
2558
+ vi.mocked(sdk.entities.importRecordsById).mockResolvedValue({
2559
+ insertedRecords: 1,
2560
+ totalRecords: 1,
2561
+ });
2562
+
2563
+ const { getFileSystem } = await import("@uipath/filesystem");
2564
+ const csvBytes = new TextEncoder().encode("title,amount\ntest,100");
2565
+ vi.mocked(getFileSystem).mockReturnValue({
2566
+ readFile: vi.fn().mockResolvedValue(csvBytes),
2567
+ path: { basename: vi.fn().mockReturnValue("data.csv") },
2568
+ } as never);
2569
+
2570
+ const program = buildProgram();
2571
+ await program.parseAsync([
2572
+ "node",
2573
+ "test",
2574
+ "records",
2575
+ "import",
2576
+ "entity-id",
2577
+ "--file",
2578
+ "data.csv",
2579
+ "--folder-key",
2580
+ "folder-guid-9",
2581
+ ]);
2582
+
2583
+ expect(sdk.entities.importRecordsById).toHaveBeenCalledWith(
2584
+ "entity-id",
2585
+ expect.any(File),
2586
+ { folderKey: "folder-guid-9" },
2587
+ );
2588
+ });
2589
+
2590
+ it("should forward --folder-key to deleteRecordsById on delete", async () => {
2591
+ const sdk = mockSdk();
2592
+
2593
+ const program = buildProgram();
2594
+ await program.parseAsync([
2595
+ "node",
2596
+ "test",
2597
+ "records",
2598
+ "delete",
2599
+ "entity-id",
2600
+ "rec-1",
2601
+ "--yes",
2602
+ "--reason",
2603
+ "cleanup",
2604
+ "--folder-key",
2605
+ "folder-guid-6",
2606
+ ]);
2607
+
2608
+ expect(sdk.entities.deleteRecordsById).toHaveBeenCalledWith(
2609
+ "entity-id",
2610
+ ["rec-1"],
2611
+ { folderKey: "folder-guid-6" },
2612
+ );
2613
+ });
2614
+
2615
+ it("should forward --folder-key to queryRecordsById on query", async () => {
2616
+ const sdk = mockSdk();
2617
+
2618
+ const program = buildProgram();
2619
+ await program.parseAsync([
2620
+ "node",
2621
+ "test",
2622
+ "records",
2623
+ "query",
2624
+ "entity-id",
2625
+ "--folder-key",
2626
+ "folder-guid-7",
2627
+ ]);
2628
+
2629
+ expect(sdk.entities.queryRecordsById).toHaveBeenCalledWith(
2630
+ "entity-id",
2631
+ expect.objectContaining({ folderKey: "folder-guid-7" }),
2632
+ );
2633
+ });
2634
+ });
@@ -19,22 +19,26 @@ interface ListOptions {
19
19
  limit: string;
20
20
  offset?: string;
21
21
  cursor?: string;
22
+ folderKey?: string;
22
23
  }
23
24
 
24
25
  interface GetOptions {
25
26
  tenant?: string;
27
+ folderKey?: string;
26
28
  }
27
29
 
28
30
  interface InsertOptions {
29
31
  tenant?: string;
30
32
  file?: string;
31
33
  body?: string;
34
+ folderKey?: string;
32
35
  }
33
36
 
34
37
  interface UpdateOptions {
35
38
  tenant?: string;
36
39
  file?: string;
37
40
  body?: string;
41
+ folderKey?: string;
38
42
  }
39
43
 
40
44
  interface DeleteOptions {
@@ -42,6 +46,7 @@ interface DeleteOptions {
42
46
  yes?: boolean;
43
47
  confirm?: boolean;
44
48
  reason?: string;
49
+ folderKey?: string;
45
50
  }
46
51
 
47
52
  interface QueryOptions {
@@ -51,11 +56,13 @@ interface QueryOptions {
51
56
  limit: string;
52
57
  offset?: string;
53
58
  cursor?: string;
59
+ folderKey?: string;
54
60
  }
55
61
 
56
62
  interface ImportOptions {
57
63
  tenant?: string;
58
64
  file?: string;
65
+ folderKey?: string;
59
66
  }
60
67
 
61
68
  interface BatchResult {
@@ -198,6 +205,10 @@ export const registerRecordsCommand = (program: Command) => {
198
205
  "--cursor <cursor>",
199
206
  "Pagination cursor from a previous response to fetch the next page",
200
207
  )
208
+ .option(
209
+ "--folder-key <key>",
210
+ "Folder key (GUID) of the folder containing the entity (for folder-scoped entities)",
211
+ )
201
212
  .examples(RECORDS_LIST_EXAMPLES)
202
213
  .trackedAction(
203
214
  processContext,
@@ -235,13 +246,18 @@ export const registerRecordsCommand = (program: Command) => {
235
246
  const sdk = await connectOrFail(options.tenant);
236
247
  if (!sdk) return;
237
248
 
249
+ const listPaginationOptions =
250
+ options.cursor !== undefined
251
+ ? { pageSize, cursor: { value: options.cursor } }
252
+ : jumpToPage !== undefined
253
+ ? { pageSize, jumpToPage }
254
+ : { pageSize };
238
255
  const [listError, result] = await catchError(
239
256
  sdk.entities.getAllRecords(entityId, {
240
- pageSize,
241
- ...(options.cursor !== undefined && {
242
- cursor: { value: options.cursor },
257
+ ...listPaginationOptions,
258
+ ...(options.folderKey !== undefined && {
259
+ folderKey: options.folderKey,
243
260
  }),
244
- ...(jumpToPage !== undefined && { jumpToPage }),
245
261
  }),
246
262
  );
247
263
 
@@ -268,6 +284,10 @@ export const registerRecordsCommand = (program: Command) => {
268
284
  .addOption(
269
285
  createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"),
270
286
  )
287
+ .option(
288
+ "--folder-key <key>",
289
+ "Folder key (GUID) of the folder containing the entity (for folder-scoped entities)",
290
+ )
271
291
  .examples(RECORDS_GET_EXAMPLES)
272
292
  .trackedAction(
273
293
  processContext,
@@ -276,7 +296,13 @@ export const registerRecordsCommand = (program: Command) => {
276
296
  if (!sdk) return;
277
297
 
278
298
  const [getError, record] = await catchError(
279
- sdk.entities.getRecordById(entityId, recordId),
299
+ sdk.entities.getRecordById(
300
+ entityId,
301
+ recordId,
302
+ options.folderKey !== undefined
303
+ ? { folderKey: options.folderKey }
304
+ : undefined,
305
+ ),
280
306
  );
281
307
 
282
308
  if (getError) {
@@ -316,6 +342,10 @@ export const registerRecordsCommand = (program: Command) => {
316
342
  "--body <json>",
317
343
  "Inline JSON record data (object or array of objects; use `-` to read from stdin)",
318
344
  )
345
+ .option(
346
+ "--folder-key <key>",
347
+ "Folder key (GUID) of the folder containing the entity (for folder-scoped entities)",
348
+ )
319
349
  .examples(RECORDS_INSERT_EXAMPLES)
320
350
  .trackedAction(
321
351
  processContext,
@@ -336,9 +366,18 @@ export const registerRecordsCommand = (program: Command) => {
336
366
  | Record<string, unknown>[];
337
367
  const recordsList = Array.isArray(data) ? data : [data];
338
368
 
369
+ const folderOptions =
370
+ options.folderKey !== undefined
371
+ ? { folderKey: options.folderKey }
372
+ : undefined;
373
+
339
374
  if (recordsList.length === 1) {
340
375
  const [insertError, result] = await catchError(
341
- sdk.entities.insertRecordById(entityId, recordsList[0]),
376
+ sdk.entities.insertRecordById(
377
+ entityId,
378
+ recordsList[0],
379
+ folderOptions,
380
+ ),
342
381
  );
343
382
 
344
383
  if (insertError) {
@@ -355,7 +394,11 @@ export const registerRecordsCommand = (program: Command) => {
355
394
  });
356
395
  } else {
357
396
  const [insertError, result] = await catchError(
358
- sdk.entities.insertRecordsById(entityId, recordsList),
397
+ sdk.entities.insertRecordsById(
398
+ entityId,
399
+ recordsList,
400
+ folderOptions,
401
+ ),
359
402
  );
360
403
 
361
404
  if (insertError) {
@@ -399,6 +442,10 @@ export const registerRecordsCommand = (program: Command) => {
399
442
  "--body <json>",
400
443
  "Inline JSON record data (must include Id field; use `-` to read from stdin)",
401
444
  )
445
+ .option(
446
+ "--folder-key <key>",
447
+ "Folder key (GUID) of the folder containing the entity (for folder-scoped entities)",
448
+ )
402
449
  .examples(RECORDS_UPDATE_EXAMPLES)
403
450
  .trackedAction(
404
451
  processContext,
@@ -419,6 +466,11 @@ export const registerRecordsCommand = (program: Command) => {
419
466
  | Record<string, unknown>[];
420
467
  const recordsList = Array.isArray(data) ? data : [data];
421
468
 
469
+ const folderOptions =
470
+ options.folderKey !== undefined
471
+ ? { folderKey: options.folderKey }
472
+ : undefined;
473
+
422
474
  if (recordsList.length === 1) {
423
475
  const record = recordsList[0];
424
476
  const recordId =
@@ -435,6 +487,7 @@ export const registerRecordsCommand = (program: Command) => {
435
487
  entityId,
436
488
  String(recordId),
437
489
  record,
490
+ folderOptions,
438
491
  ),
439
492
  );
440
493
 
@@ -465,6 +518,7 @@ export const registerRecordsCommand = (program: Command) => {
465
518
  sdk.entities.updateRecordsById(
466
519
  entityId,
467
520
  recordsList as EntityRecord[],
521
+ folderOptions,
468
522
  ),
469
523
  );
470
524
 
@@ -527,6 +581,10 @@ export const registerRecordsCommand = (program: Command) => {
527
581
  "--cursor <cursor>",
528
582
  "Pagination cursor from a previous response to fetch the next page",
529
583
  )
584
+ .option(
585
+ "--folder-key <key>",
586
+ "Folder key (GUID) of the folder containing the entity (for folder-scoped entities)",
587
+ )
530
588
  .trackedAction(
531
589
  processContext,
532
590
  async (entityId: string, options: QueryOptions) => {
@@ -591,14 +649,19 @@ export const registerRecordsCommand = (program: Command) => {
591
649
  const sdk = await connectOrFail(options.tenant);
592
650
  if (!sdk) return;
593
651
 
652
+ const queryPaginationOptions =
653
+ options.cursor !== undefined
654
+ ? { pageSize, cursor: { value: options.cursor } }
655
+ : jumpToPage !== undefined
656
+ ? { pageSize, jumpToPage }
657
+ : { pageSize };
594
658
  const [queryError, result] = await catchError(
595
659
  sdk.entities.queryRecordsById(entityId, {
596
660
  ...(queryBody !== null && queryBody),
597
- pageSize,
598
- ...(options.cursor !== undefined && {
599
- cursor: { value: options.cursor },
661
+ ...queryPaginationOptions,
662
+ ...(options.folderKey !== undefined && {
663
+ folderKey: options.folderKey,
600
664
  }),
601
- ...(jumpToPage !== undefined && { jumpToPage }),
602
665
  }),
603
666
  );
604
667
 
@@ -625,6 +688,10 @@ export const registerRecordsCommand = (program: Command) => {
625
688
  createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"),
626
689
  )
627
690
  .option("-f, --file <path>", "Path to the CSV file to import")
691
+ .option(
692
+ "--folder-key <key>",
693
+ "Folder key (GUID) of the folder containing the entity (for folder-scoped entities)",
694
+ )
628
695
  .trackedAction(
629
696
  processContext,
630
697
  async (entityId: string, options: ImportOptions) => {
@@ -654,7 +721,13 @@ export const registerRecordsCommand = (program: Command) => {
654
721
  { type: "text/csv" },
655
722
  );
656
723
  const [importError, result] = await catchError(
657
- sdk.entities.importRecordsById(entityId, csvFile),
724
+ sdk.entities.importRecordsById(
725
+ entityId,
726
+ csvFile,
727
+ options.folderKey !== undefined
728
+ ? { folderKey: options.folderKey }
729
+ : undefined,
730
+ ),
658
731
  );
659
732
 
660
733
  if (importError) {
@@ -700,6 +773,10 @@ export const registerRecordsCommand = (program: Command) => {
700
773
  "--reason <reason>",
701
774
  "Reason for the deletion — echoed back in the response so the caller can log it",
702
775
  )
776
+ .option(
777
+ "--folder-key <key>",
778
+ "Folder key (GUID) of the folder containing the entity (for folder-scoped entities)",
779
+ )
703
780
  .examples(RECORDS_DELETE_EXAMPLES)
704
781
  .trackedAction(
705
782
  processContext,
@@ -719,7 +796,13 @@ export const registerRecordsCommand = (program: Command) => {
719
796
  if (!sdk) return;
720
797
 
721
798
  const [deleteError, result] = await catchError(
722
- sdk.entities.deleteRecordsById(entityId, recordIds),
799
+ sdk.entities.deleteRecordsById(
800
+ entityId,
801
+ recordIds,
802
+ options.folderKey !== undefined
803
+ ? { folderKey: options.folderKey }
804
+ : undefined,
805
+ ),
723
806
  );
724
807
 
725
808
  if (deleteError) {