@uipath/maestro-sdk 0.2.0 → 0.9.1

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.
@@ -0,0 +1,84 @@
1
+ import type { NodeManifest } from "@uipath/flow-core";
2
+ import type { ParsedFilters } from "./types";
3
+ interface PullNodesOptions {
4
+ force?: boolean;
5
+ }
6
+ interface PullNodesResult {
7
+ syncedCount: number;
8
+ fromCache: boolean;
9
+ ageMinutes?: number;
10
+ source?: "ootb" | "authenticated";
11
+ cacheWritten?: boolean;
12
+ info?: string;
13
+ }
14
+ interface PullRemoteNodesResult {
15
+ nodes: NodeManifest[];
16
+ source: "ootb" | "authenticated";
17
+ cacheable: boolean;
18
+ info?: string;
19
+ }
20
+ /**
21
+ * Pull and sync all node sources with smart caching
22
+ *
23
+ * Simple caching strategy:
24
+ * - FRESH (< 30 min): Use cache immediately
25
+ * - EXPIRED (> 30 min): Must refresh before returning
26
+ *
27
+ * @param options - Pull options
28
+ * @param options.force - Force refresh, ignore cache (default: false)
29
+ * @returns Result with sync count and cache status
30
+ */
31
+ export declare function pullNodes(options?: PullNodesOptions): Promise<PullNodesResult>;
32
+ /**
33
+ * Pull remote nodes from the manifest API
34
+ * Only pulls if user is logged in
35
+ * Fetches all nodes (OOTB + remote) from the manifest
36
+ *
37
+ * @returns Array of all nodes from manifest
38
+ */
39
+ export declare function pullRemoteNodes(): Promise<PullRemoteNodesResult>;
40
+ /**
41
+ * List cached nodes, falling back to live OOTB nodes if no cache exists.
42
+ * With `--local`, returns only in-solution sibling project nodes and throws
43
+ * when no .uipx solution is found.
44
+ */
45
+ export declare function listNodes(options?: {
46
+ local?: boolean;
47
+ }): Promise<NodeManifest[]>;
48
+ /**
49
+ * Search for nodes by keyword
50
+ * Searches across nodeType, category, tags, and display.label
51
+ * Returns all matching nodes
52
+ */
53
+ export declare function searchNodes(keyword: string, options?: {
54
+ local?: boolean;
55
+ }): Promise<NodeManifest[]>;
56
+ /**
57
+ * Pure cache/OOTB node configuration fetch, no extra external call.
58
+ * @param nodeType
59
+ * @returns
60
+ */
61
+ export declare function getNode(nodeType: string, options?: {
62
+ local?: boolean;
63
+ }): Promise<NodeManifest | null>;
64
+ /**
65
+ * Get a specific node by nodeType (case-insensitive).
66
+ * When connectionId is provided, enriches connector nodes with
67
+ * connection-specific metadata (custom fields, accurate references).
68
+ */
69
+ export declare function getNodeEnriched(nodeType: string, connectionId?: string, options?: {
70
+ local?: boolean;
71
+ }): Promise<NodeManifest | null>;
72
+ /**
73
+ * Search nodes with advanced filtering
74
+ * Supports both keyword search and structured filters
75
+ * Uses the aggregated index (all sources)
76
+ *
77
+ * @param keyword - Optional keyword to search across all fields
78
+ * @param filters - Optional structured filter conditions
79
+ * @returns Array of matching nodes
80
+ */
81
+ export declare function searchNodesWithFilters(keyword?: string, filters?: ParsedFilters, options?: {
82
+ local?: boolean;
83
+ }): Promise<NodeManifest[]>;
84
+ export {};
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Maestro Registry Service
3
+ *
4
+ * Combines a static BPMN spec (OOTB extension types) with dynamically
5
+ * discovered resources from Integration Service (connectors, connections,
6
+ * activities, triggers) and Orchestrator (processes, agents, API workflows).
7
+ *
8
+ * Discovery is best-effort: when a particular API call fails the service
9
+ * logs a warning and continues so the caller always gets at least the
10
+ * static registry.
11
+ */
12
+ import type { BpmnExtensionType, DiscoveredConnector, DiscoveredProcess, MaestroRegistry } from "../manifest/types.js";
13
+ export interface PullRegistryOptions {
14
+ force?: boolean;
15
+ }
16
+ export interface PullRegistryResult {
17
+ extensionTypeCount: number;
18
+ connectorCount: number;
19
+ processCount: number;
20
+ fromCache: boolean;
21
+ ageMinutes?: number;
22
+ cacheWritten: boolean;
23
+ info?: string;
24
+ }
25
+ /**
26
+ * Pull (or return cached) the full Maestro registry.
27
+ *
28
+ * Cache strategy mirrors the flow-tool:
29
+ * - FRESH (< 30 min): return cache immediately
30
+ * - EXPIRED or missing: fetch fresh, write to cache, return
31
+ * - force=true: always fetch fresh
32
+ */
33
+ export declare function pullRegistry(options?: PullRegistryOptions): Promise<PullRegistryResult>;
34
+ /**
35
+ * List the cached registry. Auto-pulls if no cache exists.
36
+ */
37
+ export declare function getRegistry(): Promise<MaestroRegistry>;
38
+ /**
39
+ * Search the registry by keyword across extension types and discovered resources.
40
+ */
41
+ export declare function searchRegistry(keyword: string): Promise<{
42
+ extensionTypes: BpmnExtensionType[];
43
+ connectors: DiscoveredConnector[];
44
+ processes: DiscoveredProcess[];
45
+ }>;
46
+ /**
47
+ * Get a single extension type by key (case-insensitive).
48
+ */
49
+ export declare function getExtensionType(extensionType: string): Promise<BpmnExtensionType | null>;
50
+ /**
51
+ * IS-enriched metadata for a connector activity.
52
+ *
53
+ * Calls the IS elements API to get full field metadata for a specific
54
+ * connector + object + connection combination.
55
+ */
56
+ export declare function getEnrichedActivityMetadata(objectName: string, connectionId: string): Promise<Record<string, unknown> | null>;
@@ -0,0 +1,31 @@
1
+ import type { NodeManifest } from "@uipath/flow-core";
2
+ import { type ProjectEntryPointIO } from "@uipath/flow-core/manifest";
3
+ interface UipxProject {
4
+ Type: string;
5
+ ProjectRelativePath: string;
6
+ Id: string;
7
+ }
8
+ export interface SolutionContext {
9
+ solutionId: string;
10
+ solutionDir: string;
11
+ projects: UipxProject[];
12
+ /** ID of the project that CWD is inside — excluded from results to prevent self-reference */
13
+ currentProjectId?: string;
14
+ }
15
+ /**
16
+ * Walk CWD then its parent and grandparent (3 levels) looking for a .uipx file.
17
+ * Returns null if not inside a solution.
18
+ */
19
+ export declare function findSolutionFromCwd(): Promise<SolutionContext | null>;
20
+ /**
21
+ * Read entry-points.json from a project directory.
22
+ * Tries flat layout first, then content/ subdirectory.
23
+ */
24
+ export declare function readProjectEntryPointIO(projectDir: string): Promise<ProjectEntryPointIO>;
25
+ /**
26
+ * Build NodeManifest[] for all invokable sibling projects in the solution.
27
+ * Non-invokable types (Library, Tests, Connector, etc.) are silently skipped.
28
+ * The current project (ctx.currentProjectId) is excluded to prevent self-reference.
29
+ */
30
+ export declare function buildInSolutionNodeManifests(ctx: SolutionContext): Promise<NodeManifest[]>;
31
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Local file-system cache for the Maestro registry.
3
+ *
4
+ * Mirrors the flow-tool's nodeStorage pattern:
5
+ * ~/.uipath/maestro/registry.json — full registry
6
+ * ~/.uipath/maestro/registry.meta.json — lightweight metadata (lastSync, hash, counts)
7
+ *
8
+ * 30-minute cache expiration is enforced by the caller (registry service).
9
+ */
10
+ import type { MaestroRegistry, RegistryMetadata } from "../manifest/types.js";
11
+ /** Cache is considered fresh for 30 minutes. */
12
+ export declare const CACHE_EXPIRATION_MS: number;
13
+ /**
14
+ * Generate a SHA-256 hex hash of the given string content.
15
+ */
16
+ export declare function hashContent(content: string): Promise<string>;
17
+ /**
18
+ * Save the full registry to disk and update the companion metadata file.
19
+ */
20
+ export declare function saveRegistry(registry: MaestroRegistry): Promise<void>;
21
+ /**
22
+ * Load the full registry from disk. Returns null if cache does not exist.
23
+ */
24
+ export declare function loadRegistry(): Promise<MaestroRegistry | null>;
25
+ /**
26
+ * Load only the lightweight metadata. Returns null if missing.
27
+ */
28
+ export declare function loadRegistryMetadata(): Promise<RegistryMetadata | null>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Supported filter fields for node search
3
+ */
4
+ export type FilterField = "category" | "type" | "tags" | "displayname" | "nodetype" | "description";
5
+ /**
6
+ * Filter operator types
7
+ */
8
+ export type FilterOperator = "equals" | "contains" | "in" | "startsWith" | "endsWith";
9
+ /**
10
+ * Individual filter condition
11
+ */
12
+ export interface FilterCondition {
13
+ field: FilterField;
14
+ operator: FilterOperator;
15
+ value: string | string[];
16
+ }
17
+ /**
18
+ * Parse result from filter string
19
+ */
20
+ export interface ParsedFilters {
21
+ filters: FilterCondition[];
22
+ logic: "AND" | "OR";
23
+ }
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ export interface IncidentCommandsConfig {
3
+ /** Label used in command descriptions, e.g. "Flow", "Maestro", "Case" */
4
+ toolLabel: string;
5
+ }
6
+ export declare const registerSharedIncidentCommands: (program: Command, config: IncidentCommandsConfig) => void;
@@ -0,0 +1,14 @@
1
+ import type { Command } from "commander";
2
+ export interface InstanceCommandsConfig {
3
+ /** Label used in command descriptions, e.g. "Flow", "Maestro", "Case" */
4
+ toolLabel: string;
5
+ /** Asset type query parameter, e.g. "flow", "bpmn", "case" */
6
+ assetType: string;
7
+ /** Process type filter for the list command. Omit to not filter by type. */
8
+ processType?: string;
9
+ /** Whether to register the element-executions subcommand (default: true) */
10
+ includeElementExecutions?: boolean;
11
+ /** Whether --folder-key is required (default: true) */
12
+ folderKeyRequired?: boolean;
13
+ }
14
+ export declare const registerSharedInstanceCommands: (program: Command, config: InstanceCommandsConfig) => void;
@@ -0,0 +1,8 @@
1
+ import type { Command } from "commander";
2
+ export interface ProcessesCommandsConfig {
3
+ /** Label used in command descriptions, e.g. "Flow", "Maestro", "Case" */
4
+ toolLabel: string;
5
+ /** Process type filter for the list endpoint. Omit to not filter by type. */
6
+ processType?: string;
7
+ }
8
+ export declare const registerSharedProcessesCommands: (program: Command, config: ProcessesCommandsConfig) => void;
@@ -0,0 +1,11 @@
1
+ export declare const VALID_PROJECT_NAME_REGEX: RegExp;
2
+ export declare const VALID_PACKAGE_NAME_REGEX: RegExp;
3
+ export declare function readStdin(): Promise<string | null>;
4
+ export interface TraceEvent {
5
+ timestamp: string;
6
+ status: string;
7
+ name: string;
8
+ duration?: number;
9
+ }
10
+ export declare function formatTraceStatus(status: string): string;
11
+ export declare function formatTraceLine(trace: TraceEvent): string;
@@ -0,0 +1,126 @@
1
+ export interface PimsApiConfig {
2
+ baseUrl: string;
3
+ organizationId: string;
4
+ tenantId: string;
5
+ authToken: string;
6
+ }
7
+ export interface PimsRequestOptions {
8
+ folderKey?: string;
9
+ }
10
+ export interface ProcessInstanceRun {
11
+ runId: string;
12
+ status: string;
13
+ startedTime: string;
14
+ completedTime: string | null;
15
+ }
16
+ export interface ProcessInstance {
17
+ instanceId: string;
18
+ packageKey: string;
19
+ packageId: string;
20
+ packageVersion: string;
21
+ latestRunId: string;
22
+ latestRunStatus: string;
23
+ processKey: string;
24
+ folderKey: string;
25
+ userId: number;
26
+ instanceDisplayName: string;
27
+ startedByUser: string;
28
+ source: string;
29
+ creatorUserKey: string;
30
+ startedTime: string;
31
+ completedTime: string | null;
32
+ instanceRuns: ProcessInstanceRun[];
33
+ }
34
+ export interface ProcessInstanceOperationResponse {
35
+ instanceId: string;
36
+ status: string;
37
+ }
38
+ export interface GlobalVariableMetaData {
39
+ id: string;
40
+ name: string;
41
+ type: string;
42
+ value: unknown;
43
+ elementId: string;
44
+ source: string;
45
+ }
46
+ export interface ElementMetaData {
47
+ elementId: string;
48
+ elementRunId: string;
49
+ inputDefinitions: Record<string, unknown>;
50
+ inputs: Record<string, unknown>;
51
+ outputs: Record<string, unknown>;
52
+ isMarker: boolean;
53
+ }
54
+ export interface ProcessInstanceGetVariablesResponse {
55
+ instanceId: string;
56
+ parentElementId: string | null;
57
+ globalVariables: GlobalVariableMetaData[];
58
+ elements: ElementMetaData[];
59
+ }
60
+ export interface ProcessIncidentGetResponse {
61
+ incidentId: string;
62
+ instanceId: string;
63
+ processKey: string;
64
+ folderKey: string;
65
+ incidentType: string | null;
66
+ incidentSeverity: string | null;
67
+ incidentStatus: string;
68
+ debugMode: string;
69
+ incidentElementActivityName: string;
70
+ incidentElementActivityType: string;
71
+ elementId: string;
72
+ errorCode: string;
73
+ errorMessage: string;
74
+ errorDetails: string;
75
+ errorTime: string;
76
+ }
77
+ export interface ProcessIncidentGetAllResponse {
78
+ count: number;
79
+ errorMessage: string;
80
+ errorCode: string;
81
+ firstTimeUtc: string;
82
+ processKey: string;
83
+ }
84
+ export interface MaestroProcessSummary {
85
+ processKey: string;
86
+ runningCount: number;
87
+ faultedCount: number;
88
+ }
89
+ export interface GoToTransition {
90
+ sourceElementId: string;
91
+ targetElementId: string;
92
+ }
93
+ export interface GoToCursorsResponse {
94
+ elementIds: string[];
95
+ }
96
+ export interface ElementExecutionApi {
97
+ completedTimeUtc: string | null;
98
+ elementId: string;
99
+ elementType: string;
100
+ elementExtensionType: string | null;
101
+ parentRunId: string | null;
102
+ parentElementId: string | null;
103
+ parentElementRunId: string | null;
104
+ runId: string;
105
+ startedTimeUtc: string | null;
106
+ status: string;
107
+ elementRuns: unknown[];
108
+ }
109
+ export interface GetInstanceElementExecutionsResponse {
110
+ creationUserKey: string | null;
111
+ folderKey: string;
112
+ instanceDisplayName: string;
113
+ instanceId: string;
114
+ organizationId: string;
115
+ packageId: string;
116
+ packageKey: string;
117
+ packageVersion: string;
118
+ processKey: string;
119
+ source: string;
120
+ tenantId: string;
121
+ status: string;
122
+ startedTimeUtc: string;
123
+ completedTimeUtc: string | null;
124
+ elementExecutions: ElementExecutionApi[];
125
+ traceId: string | null;
126
+ }
@@ -0,0 +1,2 @@
1
+ import type { PimsApiConfig } from "./types";
2
+ export declare function withPimsCall<T>(fn: (config: PimsApiConfig) => Promise<T>, errorMessage: string): Promise<T | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.9.1",
4
4
  "description": "SDK for the UiPath Maestro (PIMS) API — process instance management.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,20 +18,32 @@
18
18
  ],
19
19
  "type": "module",
20
20
  "main": "./dist/index.js",
21
+ "types": "./dist/src/index.d.ts",
21
22
  "exports": {
22
- ".": "./dist/index.js"
23
+ ".": {
24
+ "types": "./dist/src/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ }
23
27
  },
24
28
  "files": [
25
29
  "dist"
26
30
  ],
27
31
  "scripts": {
28
- "build": "bun build ./src/index.ts --outdir dist --format esm --target node",
32
+ "build": "bun build ./src/index.ts --outdir dist --format esm --target node && tsc -p tsconfig.build.json --noCheck",
33
+ "test": "vitest run",
34
+ "test:coverage": "vitest run --coverage",
29
35
  "lint": "biome check ."
30
36
  },
31
37
  "devDependencies": {
32
- "@uipath/auth": "0.2.0",
33
- "@uipath/common": "0.2.0",
38
+ "@uipath/auth": "0.9.1",
39
+ "@uipath/common": "0.9.1",
40
+ "@uipath/filesystem": "0.9.1",
41
+ "@uipath/flow-core": "^0.2.0",
42
+ "@uipath/integrationservice-sdk": "0.9.1",
43
+ "@uipath/orchestrator-sdk": "0.9.1",
34
44
  "@types/node": "^25.5.0",
45
+ "commander": "^14.0.3",
35
46
  "typescript": "^5"
36
- }
47
+ },
48
+ "gitHead": "e8da2857e37a9495c4907cd39f47c9d6ed1a5566"
37
49
  }