@uipath/data-fabric-tool 1.198.0 → 1.199.0-preview.104

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/data-fabric-tool",
3
3
  "license": "MIT",
4
- "version": "1.198.0",
4
+ "version": "1.199.0-preview.104",
5
5
  "description": "Manage Data Fabric entities and records.",
6
6
  "type": "module",
7
7
  "main": "./dist/tool.js",
@@ -14,5 +14,5 @@
14
14
  "publishConfig": {
15
15
  "registry": "https://registry.npmjs.org/"
16
16
  },
17
- "gitHead": "1fadf03d7a8dd102742571dff569fdac11808afb"
17
+ "gitHead": "829a8ab8a25bce5b62c284bd1ddc674d2947f647"
18
18
  }
@@ -438,7 +438,7 @@ describe("choice-sets create", () => {
438
438
  "test",
439
439
  "choice-sets",
440
440
  "create",
441
- "X",
441
+ "ExpenseTypes",
442
442
  ]);
443
443
  expect(OutputFormatter.error).toHaveBeenCalledWith(
444
444
  expect.objectContaining({
@@ -448,6 +448,28 @@ describe("choice-sets create", () => {
448
448
  );
449
449
  expect(process.exitCode).toBe(1);
450
450
  });
451
+
452
+ it("should reject a choice set name that fails validation", async () => {
453
+ const sdk = mockSdk();
454
+ const program = buildProgram();
455
+ await program.parseAsync([
456
+ "node",
457
+ "test",
458
+ "choice-sets",
459
+ "create",
460
+ "1BadName",
461
+ ]);
462
+ expect(sdk.entities.choicesets.create).not.toHaveBeenCalled();
463
+ expect(OutputFormatter.error).toHaveBeenCalledWith(
464
+ expect.objectContaining({
465
+ Result: "Failure",
466
+ Message: expect.stringContaining(
467
+ "Invalid choice set name '1BadName'",
468
+ ),
469
+ }),
470
+ );
471
+ expect(process.exitCode).toBe(1);
472
+ });
451
473
  });
452
474
 
453
475
  describe("choice-sets update", () => {
@@ -456,7 +478,7 @@ describe("choice-sets update", () => {
456
478
  process.exitCode = undefined;
457
479
  });
458
480
 
459
- it("should update a choice set's metadata", async () => {
481
+ it("should update a choice set's metadata when both flags are passed", async () => {
460
482
  const sdk = mockSdk();
461
483
  const program = buildProgram();
462
484
  await program.parseAsync([
@@ -467,11 +489,14 @@ describe("choice-sets update", () => {
467
489
  "cs-1",
468
490
  "--display-name",
469
491
  "New Name",
492
+ "--description",
493
+ "New description",
470
494
  ]);
471
495
  expect(sdk.entities.choicesets.updateById).toHaveBeenCalledWith(
472
496
  "cs-1",
473
497
  {
474
498
  displayName: "New Name",
499
+ description: "New description",
475
500
  },
476
501
  );
477
502
  expect(OutputFormatter.success).toHaveBeenCalledWith(
@@ -483,7 +508,7 @@ describe("choice-sets update", () => {
483
508
  );
484
509
  });
485
510
 
486
- it("should error when no update fields are provided", async () => {
511
+ it("should reject a partial update (only --display-name)", async () => {
487
512
  const sdk = mockSdk();
488
513
  const program = buildProgram();
489
514
  await program.parseAsync([
@@ -492,12 +517,62 @@ describe("choice-sets update", () => {
492
517
  "choice-sets",
493
518
  "update",
494
519
  "cs-1",
520
+ "--display-name",
521
+ "New Name",
495
522
  ]);
496
523
  expect(sdk.entities.choicesets.updateById).not.toHaveBeenCalled();
497
524
  expect(OutputFormatter.error).toHaveBeenCalledWith(
498
525
  expect.objectContaining({
499
526
  Result: "Failure",
500
- Message: "No update fields provided",
527
+ Message: expect.stringContaining(
528
+ "requires both --display-name and --description",
529
+ ),
530
+ }),
531
+ );
532
+ expect(process.exitCode).toBe(1);
533
+ });
534
+
535
+ it("should reject a partial update (only --description)", async () => {
536
+ const sdk = mockSdk();
537
+ const program = buildProgram();
538
+ await program.parseAsync([
539
+ "node",
540
+ "test",
541
+ "choice-sets",
542
+ "update",
543
+ "cs-1",
544
+ "--description",
545
+ "New description",
546
+ ]);
547
+ expect(sdk.entities.choicesets.updateById).not.toHaveBeenCalled();
548
+ expect(OutputFormatter.error).toHaveBeenCalledWith(
549
+ expect.objectContaining({
550
+ Result: "Failure",
551
+ Message: expect.stringContaining(
552
+ "requires both --display-name and --description",
553
+ ),
554
+ }),
555
+ );
556
+ expect(process.exitCode).toBe(1);
557
+ });
558
+
559
+ it("should error when no update flags are provided", async () => {
560
+ const sdk = mockSdk();
561
+ const program = buildProgram();
562
+ await program.parseAsync([
563
+ "node",
564
+ "test",
565
+ "choice-sets",
566
+ "update",
567
+ "cs-1",
568
+ ]);
569
+ expect(sdk.entities.choicesets.updateById).not.toHaveBeenCalled();
570
+ expect(OutputFormatter.error).toHaveBeenCalledWith(
571
+ expect.objectContaining({
572
+ Result: "Failure",
573
+ Message: expect.stringContaining(
574
+ "requires both --display-name and --description",
575
+ ),
501
576
  }),
502
577
  );
503
578
  expect(process.exitCode).toBe(1);
@@ -515,6 +590,8 @@ describe("choice-sets update", () => {
515
590
  "choice-sets",
516
591
  "update",
517
592
  "missing",
593
+ "--display-name",
594
+ "y",
518
595
  "--description",
519
596
  "x",
520
597
  ]);
@@ -715,6 +792,29 @@ describe("choice-set-values", () => {
715
792
  expect(process.exitCode).toBe(1);
716
793
  });
717
794
 
795
+ it("should reject a choice-set value name that hits the keyword blocklist", async () => {
796
+ const sdk = mockSdk();
797
+ const program = buildValuesProgram();
798
+ await program.parseAsync([
799
+ "node",
800
+ "test",
801
+ "choice-set-values",
802
+ "create",
803
+ "cs-1",
804
+ "internal",
805
+ ]);
806
+ expect(sdk.entities.choicesets.insertValueById).not.toHaveBeenCalled();
807
+ expect(OutputFormatter.error).toHaveBeenCalledWith(
808
+ expect.objectContaining({
809
+ Result: "Failure",
810
+ Message: expect.stringContaining(
811
+ "Choice-set value name 'internal' is a reserved C# keyword",
812
+ ),
813
+ }),
814
+ );
815
+ expect(process.exitCode).toBe(1);
816
+ });
817
+
718
818
  it("should update a value's display name", async () => {
719
819
  const sdk = mockSdk();
720
820
  const program = buildValuesProgram();
@@ -985,6 +1085,8 @@ describe("choice-sets --folder-key forwarding", () => {
985
1085
  "cs-1",
986
1086
  "--display-name",
987
1087
  "New",
1088
+ "--description",
1089
+ "Updated description",
988
1090
  "--folder-key",
989
1091
  "folder-2",
990
1092
  ]);
@@ -992,6 +1094,7 @@ describe("choice-sets --folder-key forwarding", () => {
992
1094
  "cs-1",
993
1095
  {
994
1096
  displayName: "New",
1097
+ description: "Updated description",
995
1098
  folderKey: "folder-2",
996
1099
  },
997
1100
  );
@@ -21,6 +21,7 @@ import type {
21
21
  import { type Command, Option } from "commander";
22
22
  import { fail, requireDestructiveConfirmation } from "../utils/output";
23
23
  import { connectOrFail } from "../utils/sdk-client";
24
+ import { validateChoiceValueName, validateName } from "../utils/validate";
24
25
 
25
26
  const OUTPUT_CODES = {
26
27
  ChoiceSetList: "ChoiceSetList",
@@ -365,6 +366,9 @@ export const registerChoiceSetsCommand = (program: Command) => {
365
366
  .trackedAction(
366
367
  processContext,
367
368
  async (name: string, options: CreateOptions) => {
369
+ const nameErr = validateName(name, "choice set");
370
+ if (nameErr) return fail(nameErr.message, nameErr.instructions);
371
+
368
372
  const sdk = await connectOrFail(options.tenant);
369
373
  if (!sdk) return;
370
374
 
@@ -423,13 +427,18 @@ export const registerChoiceSetsCommand = (program: Command) => {
423
427
  .trackedAction(
424
428
  processContext,
425
429
  async (choiceSetId: string, options: UpdateOptions) => {
430
+ // Server-side quirk: sending only --description returns
431
+ // "DisplayName is required."; sending only --display-name
432
+ // returns Internal Server Error. Both are required together.
433
+ // To change one, re-send the other's current value from
434
+ // `choice-sets list`.
426
435
  if (
427
- options.displayName === undefined &&
436
+ options.displayName === undefined ||
428
437
  options.description === undefined
429
438
  ) {
430
439
  return fail(
431
- "No update fields provided",
432
- "Provide at least one of --display-name or --description.",
440
+ "choice-sets update requires both --display-name and --description",
441
+ "The server rejects a partial update with 'DisplayName is required.' or Internal Server Error. To change one field, run 'uip df choice-sets list' first to read the current value of the other, then re-send both with --display-name and --description.",
433
442
  );
434
443
  }
435
444
 
@@ -623,6 +632,9 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
623
632
  name: string,
624
633
  options: ValueCreateOptions,
625
634
  ) => {
635
+ const nameErr = validateChoiceValueName(name);
636
+ if (nameErr) return fail(nameErr.message, nameErr.instructions);
637
+
626
638
  const sdk = await connectOrFail(options.tenant);
627
639
  if (!sdk) return;
628
640