@uipath/data-fabric-tool 1.195.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.
- package/dist/index.js +2 -0
- package/dist/tool.js +6037 -6015
- package/package.json +2 -2
- package/src/commands/choice-sets.spec.ts +262 -13
- package/src/commands/choice-sets.ts +126 -8
- package/src/commands/entities.spec.ts +302 -14
- package/src/commands/entities.ts +111 -9
- package/src/commands/files.spec.ts +108 -3
- package/src/commands/files.ts +45 -2
- package/src/commands/records.spec.ts +323 -0
- package/src/commands/records.ts +120 -18
- package/src/utils/input.spec.ts +127 -0
- package/src/utils/input.ts +30 -1
- package/src/utils/output.spec.ts +22 -9
- package/src/utils/output.ts +27 -9
|
@@ -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({
|
|
@@ -1067,11 +1074,15 @@ describe("records delete", () => {
|
|
|
1067
1074
|
"entity-id",
|
|
1068
1075
|
"rec-1",
|
|
1069
1076
|
"rec-2",
|
|
1077
|
+
"--yes",
|
|
1078
|
+
"--reason",
|
|
1079
|
+
"test cleanup",
|
|
1070
1080
|
]);
|
|
1071
1081
|
|
|
1072
1082
|
expect(sdk.entities.deleteRecordsById).toHaveBeenCalledWith(
|
|
1073
1083
|
"entity-id",
|
|
1074
1084
|
["rec-1", "rec-2"],
|
|
1085
|
+
undefined,
|
|
1075
1086
|
);
|
|
1076
1087
|
expect(OutputFormatter.success).toHaveBeenCalledWith(
|
|
1077
1088
|
expect.objectContaining({
|
|
@@ -1093,6 +1104,9 @@ describe("records delete", () => {
|
|
|
1093
1104
|
"delete",
|
|
1094
1105
|
"entity-id",
|
|
1095
1106
|
"rec-1",
|
|
1107
|
+
"--yes",
|
|
1108
|
+
"--reason",
|
|
1109
|
+
"test cleanup",
|
|
1096
1110
|
]);
|
|
1097
1111
|
expect(sdk.entities.deleteRecordsById).toHaveBeenCalled();
|
|
1098
1112
|
expect(OutputFormatter.success).toHaveBeenCalledWith(
|
|
@@ -1119,6 +1133,9 @@ describe("records delete", () => {
|
|
|
1119
1133
|
"delete",
|
|
1120
1134
|
"entity-id",
|
|
1121
1135
|
"rec-1",
|
|
1136
|
+
"--yes",
|
|
1137
|
+
"--reason",
|
|
1138
|
+
"test cleanup",
|
|
1122
1139
|
]);
|
|
1123
1140
|
|
|
1124
1141
|
expect(OutputFormatter.error).toHaveBeenCalledWith(
|
|
@@ -1142,6 +1159,9 @@ describe("records delete", () => {
|
|
|
1142
1159
|
"entity-id",
|
|
1143
1160
|
"rec-1",
|
|
1144
1161
|
"rec-2",
|
|
1162
|
+
"--yes",
|
|
1163
|
+
"--reason",
|
|
1164
|
+
"test cleanup",
|
|
1145
1165
|
]);
|
|
1146
1166
|
expect(OutputFormatter.success).toHaveBeenCalledWith(
|
|
1147
1167
|
expect.objectContaining({
|
|
@@ -1155,6 +1175,79 @@ describe("records delete", () => {
|
|
|
1155
1175
|
);
|
|
1156
1176
|
expect(process.exitCode).toBe(1);
|
|
1157
1177
|
});
|
|
1178
|
+
|
|
1179
|
+
it("should accept --confirm as a deprecated alias for --yes", async () => {
|
|
1180
|
+
const sdk = mockSdk();
|
|
1181
|
+
|
|
1182
|
+
const program = buildProgram();
|
|
1183
|
+
await program.parseAsync([
|
|
1184
|
+
"node",
|
|
1185
|
+
"test",
|
|
1186
|
+
"records",
|
|
1187
|
+
"delete",
|
|
1188
|
+
"entity-id",
|
|
1189
|
+
"rec-1",
|
|
1190
|
+
"--confirm",
|
|
1191
|
+
"--reason",
|
|
1192
|
+
"test cleanup",
|
|
1193
|
+
]);
|
|
1194
|
+
|
|
1195
|
+
expect(sdk.entities.deleteRecordsById).toHaveBeenCalledWith(
|
|
1196
|
+
"entity-id",
|
|
1197
|
+
["rec-1"],
|
|
1198
|
+
undefined,
|
|
1199
|
+
);
|
|
1200
|
+
expect(OutputFormatter.success).toHaveBeenCalledWith(
|
|
1201
|
+
expect.objectContaining({
|
|
1202
|
+
Result: "Success",
|
|
1203
|
+
Code: "RecordsDeleted",
|
|
1204
|
+
}),
|
|
1205
|
+
);
|
|
1206
|
+
});
|
|
1207
|
+
|
|
1208
|
+
it("should require confirmation: without --yes, exit 1 and SDK not called", async () => {
|
|
1209
|
+
const sdk = mockSdk();
|
|
1210
|
+
|
|
1211
|
+
const program = buildProgram();
|
|
1212
|
+
await program.parseAsync([
|
|
1213
|
+
"node",
|
|
1214
|
+
"test",
|
|
1215
|
+
"records",
|
|
1216
|
+
"delete",
|
|
1217
|
+
"entity-id",
|
|
1218
|
+
"rec-1",
|
|
1219
|
+
"--reason",
|
|
1220
|
+
"test cleanup",
|
|
1221
|
+
]);
|
|
1222
|
+
|
|
1223
|
+
expect(sdk.entities.deleteRecordsById).not.toHaveBeenCalled();
|
|
1224
|
+
expect(OutputFormatter.success).not.toHaveBeenCalled();
|
|
1225
|
+
expect(process.exitCode).toBe(1);
|
|
1226
|
+
});
|
|
1227
|
+
|
|
1228
|
+
it("should require --reason when confirmation is present", async () => {
|
|
1229
|
+
const sdk = mockSdk();
|
|
1230
|
+
|
|
1231
|
+
const program = buildProgram();
|
|
1232
|
+
await program.parseAsync([
|
|
1233
|
+
"node",
|
|
1234
|
+
"test",
|
|
1235
|
+
"records",
|
|
1236
|
+
"delete",
|
|
1237
|
+
"entity-id",
|
|
1238
|
+
"rec-1",
|
|
1239
|
+
"--yes",
|
|
1240
|
+
]);
|
|
1241
|
+
|
|
1242
|
+
expect(sdk.entities.deleteRecordsById).not.toHaveBeenCalled();
|
|
1243
|
+
expect(OutputFormatter.error).toHaveBeenCalledWith(
|
|
1244
|
+
expect.objectContaining({
|
|
1245
|
+
Result: "Failure",
|
|
1246
|
+
Message: "Reason required for destructive operation",
|
|
1247
|
+
}),
|
|
1248
|
+
);
|
|
1249
|
+
expect(process.exitCode).toBe(1);
|
|
1250
|
+
});
|
|
1158
1251
|
});
|
|
1159
1252
|
|
|
1160
1253
|
describe("records delete client error", () => {
|
|
@@ -1208,6 +1301,7 @@ describe("records insert via --file", () => {
|
|
|
1208
1301
|
expect(sdk.entities.insertRecordById).toHaveBeenCalledWith(
|
|
1209
1302
|
"entity-id",
|
|
1210
1303
|
expect.objectContaining({ amount: 100 }),
|
|
1304
|
+
undefined,
|
|
1211
1305
|
);
|
|
1212
1306
|
expect(OutputFormatter.success).toHaveBeenCalledWith(
|
|
1213
1307
|
expect.objectContaining({
|
|
@@ -1681,6 +1775,7 @@ describe("records import", () => {
|
|
|
1681
1775
|
expect(sdk.entities.importRecordsById).toHaveBeenCalledWith(
|
|
1682
1776
|
"entity-id",
|
|
1683
1777
|
expect.any(File),
|
|
1778
|
+
undefined,
|
|
1684
1779
|
);
|
|
1685
1780
|
expect(OutputFormatter.success).toHaveBeenCalledWith(
|
|
1686
1781
|
expect.objectContaining({
|
|
@@ -2242,6 +2337,9 @@ describe("records — negative scenarios", () => {
|
|
|
2242
2337
|
"delete",
|
|
2243
2338
|
"entity-id",
|
|
2244
2339
|
"nonexistent-record-id",
|
|
2340
|
+
"--yes",
|
|
2341
|
+
"--reason",
|
|
2342
|
+
"test cleanup",
|
|
2245
2343
|
]);
|
|
2246
2344
|
|
|
2247
2345
|
expect(OutputFormatter.error).toHaveBeenCalledWith(
|
|
@@ -2309,3 +2407,228 @@ describe("records — negative scenarios", () => {
|
|
|
2309
2407
|
expect(process.exitCode).toBe(1);
|
|
2310
2408
|
});
|
|
2311
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
|
+
});
|