@uipath/data-fabric-tool 0.9.0

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/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env bun
2
+ import { Command } from "commander";
3
+ import pkg from "../package.json" with { type: "json" };
4
+ import { registerEntitiesCommand } from "./commands/entities";
5
+ import { registerFilesCommand } from "./commands/files";
6
+ import { registerRecordsCommand } from "./commands/records";
7
+
8
+ const program = new Command();
9
+ program
10
+ .name("data-fabric-tool")
11
+ .description("UiPath Data Fabric Tool - Standalone CLI")
12
+ .version(pkg.version);
13
+
14
+ registerEntitiesCommand(program);
15
+ registerRecordsCommand(program);
16
+ registerFilesCommand(program);
17
+ await program.parseAsync(process.argv);
package/src/tool.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { Command } from "commander";
2
+ import pkg from "../package.json" with { type: "json" };
3
+ import { registerEntitiesCommand } from "./commands/entities";
4
+ import { registerFilesCommand } from "./commands/files";
5
+ import { registerRecordsCommand } from "./commands/records";
6
+
7
+ export const metadata = {
8
+ name: "data-fabric-tool",
9
+ version: pkg.version,
10
+ description:
11
+ "Manage Data Fabric entity schemas, records, and file attachments.",
12
+ commandPrefix: "df",
13
+ };
14
+
15
+ export const registerCommands = async (program: Command): Promise<void> => {
16
+ registerEntitiesCommand(program);
17
+ registerRecordsCommand(program);
18
+ registerFilesCommand(program);
19
+ };
@@ -0,0 +1,32 @@
1
+ import { getFileSystem } from "@uipath/filesystem";
2
+
3
+ export async function readFileBinary(filePath: string): Promise<Uint8Array> {
4
+ const fs = getFileSystem();
5
+ const content = await fs.readFile(filePath);
6
+ if (content === null) {
7
+ throw new Error(`Could not read file: ${filePath}`);
8
+ }
9
+ return content;
10
+ }
11
+
12
+ export async function readJsonInput(
13
+ filePath?: string,
14
+ inline?: string,
15
+ missingMsg = "Provide either --file <path> or inline data.",
16
+ ): Promise<unknown> {
17
+ if (!filePath && !inline) {
18
+ throw new Error(missingMsg);
19
+ }
20
+ let raw: string;
21
+ if (filePath) {
22
+ const fs = getFileSystem();
23
+ const content = await fs.readFile(filePath, "utf-8");
24
+ if (content === null) {
25
+ throw new Error(`Could not read file: ${filePath}`);
26
+ }
27
+ raw = content;
28
+ } else {
29
+ raw = inline as string;
30
+ }
31
+ return JSON.parse(raw);
32
+ }
@@ -0,0 +1,23 @@
1
+ import { getLoginStatusAsync } from "@uipath/auth";
2
+ import { UiPath } from "@uipath/uipath-typescript";
3
+
4
+ export const createDataFabricClient = async (
5
+ tenantOverride?: string,
6
+ ): Promise<UiPath> => {
7
+ const status = await getLoginStatusAsync();
8
+
9
+ if (
10
+ status.loginStatus !== "Logged in" ||
11
+ !status.accessToken ||
12
+ !status.baseUrl
13
+ ) {
14
+ throw new Error(status.hint ?? "Not logged in. Run 'uip login' first.");
15
+ }
16
+
17
+ return new UiPath({
18
+ secret: status.accessToken,
19
+ baseUrl: status.baseUrl,
20
+ orgName: status.organizationName,
21
+ tenantName: tenantOverride ?? status.tenantName,
22
+ });
23
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "types": ["node"]
6
+ },
7
+ "include": ["src/**/*", "tests/**/*", "vitest*.ts"],
8
+ "exclude": ["node_modules", "dist"]
9
+ }
@@ -0,0 +1 @@
1
+ export { default } from "../../vitest.base.config";