@uipath/uipath-typescript 1.0.0-beta.14 → 1.0.0-beta.15

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/README.md CHANGED
@@ -1,45 +1,115 @@
1
+ <div align="center">
2
+
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="./docs/assets/logo-dark.svg">
5
+ <source media="(prefers-color-scheme: light)" srcset="./docs/assets/logo-light.svg">
6
+ <img src="./docs/assets/logo-dark.svg" alt="UiPath Logo" width="200">
7
+ </picture>
8
+
9
+
10
+
11
+
1
12
  # UiPath TypeScript SDK
2
13
 
3
- [View Full API Reference ↗](https://uipath.github.io/uipath-typescript/getting-started/)
14
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
15
+ [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=flat&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
16
+ [![Node.js](https://img.shields.io/badge/Node.js-43853D?style=flat&logo=node.js&logoColor=white)](https://nodejs.org/)
17
+ [![npm](https://img.shields.io/npm/v/@uipath/uipath-typescript?logo=npm)](https://www.npmjs.com/package/@uipath/uipath-typescript)
18
+ [![GitHub](https://img.shields.io/github/stars/UiPath/uipath-typescript?style=social)](https://github.com/UiPath/uipath-typescript)
19
+
20
+ [Documentation](https://uipath.github.io/uipath-typescript/) • [Getting Started](#getting-started) • [Usage](#usage) • [Samples](#samples)
4
21
 
5
22
  A comprehensive TypeScript SDK for interacting with UiPath Platform services.
6
23
 
7
- ## Installation
24
+ </div>
25
+
26
+ <details>
27
+ <summary><strong>Table of Contents</strong></summary>
28
+
29
+ - [Overview](#overview)
30
+ - [Getting Started](#getting-started)
31
+ - [Prerequisites](#prerequisites)
32
+ - [Installation](#installation)
33
+ - [Quick Start](#quick-start)
34
+ - [Authentication](#authentication)
35
+ - [Authentication Methods](#authentication-methods)
36
+ - [SDK Initialization](#sdk-initialization)
37
+ - [OAuth Integration Patterns](#oauth-integration-patterns)
38
+ - [Usage](#usage)
39
+ - [Samples](#samples)
40
+ - [Development](#development)
41
+
42
+ </details>
43
+
44
+ ## Overview
45
+
46
+ The **UiPath TypeScript SDK** is a comprehensive, type-safe library for interacting with UiPath Platform services. Built with modern TypeScript, it provides seamless integration for both browser and Node.js applications, enabling developers to build sophisticated automation solutions with enterprise-grade reliability.
47
+
48
+ <div align="right">
49
+
50
+ </div>
51
+
52
+ ## Getting Started
53
+
54
+ ### Prerequisites
55
+
56
+ - **Node.js** 18.x or higher
57
+ - **npm** 8.x or higher (or yarn/pnpm)
58
+ - **TypeScript** 4.5+ (for TypeScript projects)
59
+
60
+ ### Installation
8
61
 
9
62
  ```bash
63
+ # Using npm
10
64
  npm install @uipath/uipath-typescript
11
- # or
65
+
66
+ # Using yarn
12
67
  yarn add @uipath/uipath-typescript
13
- # or
68
+
69
+ # Using pnpm
14
70
  pnpm add @uipath/uipath-typescript
15
71
  ```
16
72
 
17
-
18
- ## Quick Start
73
+ ### Quick Start
19
74
 
20
75
  ```typescript
21
76
  import { UiPath } from '@uipath/uipath-typescript';
22
77
 
23
- // Initialize the SDK
78
+ // Initialize the SDK with OAuth
24
79
  const sdk = new UiPath({
25
80
  baseUrl: 'https://cloud.uipath.com',
26
81
  orgName: 'your-organization',
27
82
  tenantName: 'your-tenant',
28
- secret: 'your-secret' //PAT Token or Bearer Token
83
+ clientId: 'your-client-id',
84
+ redirectUri: 'your-redirect-uri',
85
+ scope: 'your-scopes'
29
86
  });
30
87
 
88
+ // Initialize OAuth flow
89
+ await sdk.initialize();
90
+
31
91
  // Use the services
32
92
  const processes = await sdk.maestro.processes.getAll();
33
93
  const tasks = await sdk.tasks.getAll();
34
94
  ```
35
95
 
96
+ <div align="right">
97
+
98
+ [↑ Back to top](#uipath-typescript-sdk)
99
+
100
+ </div>
101
+
36
102
  ## Authentication
37
103
 
104
+ ### Authentication Methods
105
+
38
106
  The SDK supports two authentication methods:
39
107
 
40
108
  For OAuth, first create a non confidential [External App](https://docs.uipath.com/automation-cloud/automation-cloud/latest/admin-guide/managing-external-applications) with the required scopes and provide the clientId, redirectUri, and scope here.
41
109
 
42
- ### 1. OAuth Authentication
110
+ <details>
111
+ <summary><strong>1. OAuth Authentication (Recommended)</strong></summary>
112
+
43
113
  ```typescript
44
114
  const sdk = new UiPath({
45
115
  baseUrl: 'https://cloud.uipath.com',
@@ -54,8 +124,11 @@ const sdk = new UiPath({
54
124
  await sdk.initialize();
55
125
  ```
56
126
 
127
+ </details>
128
+
129
+ <details>
130
+ <summary><strong>2. Secret-based Authentication</strong></summary>
57
131
 
58
- ### 2. Secret-based Authentication
59
132
  ```typescript
60
133
  const sdk = new UiPath({
61
134
  baseUrl: 'https://cloud.uipath.com',
@@ -65,16 +138,19 @@ const sdk = new UiPath({
65
138
  });
66
139
  ```
67
140
 
68
- ## SDK Initialization - The initialize() Method
141
+ </details>
142
+
143
+ ### SDK Initialization
69
144
 
70
- ### When to Use initialize()
145
+ <details>
146
+ <summary><strong>When to Use initialize()</strong></summary>
71
147
 
72
148
  The `initialize()` method completes the authentication process for the SDK:
73
149
 
74
150
  - **Secret Authentication**: Auto-initializes when creating the SDK instance - **no need to call initialize()**
75
151
  - **OAuth Authentication**: **MUST call** `await sdk.initialize()` before using any SDK services
76
152
 
77
- ### Example: Secret Authentication (Auto-initialized)
153
+ #### Example: Secret Authentication (Auto-initialized)
78
154
  ```typescript
79
155
  const sdk = new UiPath({
80
156
  baseUrl: 'https://cloud.uipath.com',
@@ -87,7 +163,7 @@ const sdk = new UiPath({
87
163
  const tasks = await sdk.tasks.getAll();
88
164
  ```
89
165
 
90
- ### Example: OAuth Authentication (Requires initialize)
166
+ #### Example: OAuth Authentication (Requires initialize)
91
167
  ```typescript
92
168
  const sdk = new UiPath({
93
169
  baseUrl: 'https://cloud.uipath.com',
@@ -110,9 +186,14 @@ try {
110
186
  }
111
187
  ```
112
188
 
113
- ## OAuth Integration Patterns
189
+ </details>
190
+
191
+ ### OAuth Integration Patterns
192
+
193
+ <details>
194
+ <summary><strong>View Integration Patterns</strong></summary>
114
195
 
115
- ### Auto-login on App Load
196
+ #### Auto-login on App Load
116
197
  ```typescript
117
198
  useEffect(() => {
118
199
  const initSDK = async () => {
@@ -123,7 +204,7 @@ useEffect(() => {
123
204
  }, []);
124
205
  ```
125
206
 
126
- ### User-Triggered Login
207
+ #### User-Triggered Login
127
208
  ```typescript
128
209
  const onLogin = async () => {
129
210
  await sdk.initialize();
@@ -139,19 +220,29 @@ useEffect(() => {
139
220
  }, []);
140
221
  ```
141
222
 
142
- ### Available OAuth Methods
223
+ #### Available OAuth Methods
143
224
  - `sdk.initialize()` - Start OAuth flow (auto completes also based on callback state)
144
225
  - `sdk.isInitialized()` - Check if SDK initialization completed
145
226
  - `sdk.isAuthenticated()` - Check if user has valid token
146
227
  - `sdk.isInOAuthCallback()` - Check if processing OAuth redirect
147
228
  - `sdk.completeOAuth()` - Manually complete OAuth (advanced use)
148
229
 
149
- ## Available Services
230
+ </details>
231
+
232
+ <div align="right">
233
+
234
+ [↑ Back to top](#uipath-typescript-sdk)
235
+
236
+ </div>
237
+
238
+ ## Usage
150
239
 
151
240
  The SDK provides access to the following services through a consistent API:
152
241
 
153
242
  - `sdk.maestro.processes` - Manage agentic maestro processes
154
243
  - `sdk.maestro.processes.instances` - Manage maestro process executions
244
+ - `sdk.maestro.cases` - Manage maestro case management processes
245
+ - `sdk.maestro.cases.instances` - Manage maestro case executions
155
246
  - `sdk.tasks` - Create and manage tasks
156
247
  - `sdk.entities` - Data Fabric entity operations
157
248
  - `sdk.processes` - Manage Orchestrator processes
@@ -159,145 +250,123 @@ The SDK provides access to the following services through a consistent API:
159
250
  - `sdk.queues` - Manage Orchestrator queues
160
251
  - `sdk.assets` - Manage Orchestrator assets
161
252
 
253
+ <details>
254
+ <summary><strong>View Example Usage</strong></summary>
162
255
 
163
- **Example usage**:
164
256
  ```typescript
165
- // Get all processes
166
- const bpmnProcesses = await sdk.maestro.processes.getAll();
257
+ // Maestro - Get processes and their instances
258
+ const processes = await sdk.maestro.processes.getAll();
259
+ const instances = await sdk.maestro.processes.instances.getAll({
260
+ processKey: 'my-process',
261
+ pageSize: 10
262
+ });
167
263
 
168
- // Get a specific task
169
- const task = await sdk.tasks.getById('task-id');
264
+ // Control Process Instances
265
+ await sdk.maestro.processes.instances.pause(instanceId, 'folder-key');
266
+ await sdk.maestro.processes.instances.resume(instanceId, 'folder-key');
267
+ await sdk.maestro.processes.instances.cancel(instanceId, 'folder-key', {
268
+ comment: 'Cancelled due to error'
269
+ });
170
270
 
171
- // Create a new entity
172
- const entity = await sdk.entities.create({...});
271
+ // Maestro Case Instances
272
+ const caseInstance = await sdk.maestro.cases.instances.getById(instanceId, 'folder-key');
273
+ const stages = await sdk.maestro.cases.instances.getStages(instanceId, 'folder-key');
173
274
 
174
- // Get all buckets
175
- const buckets = await sdk.buckets.getAll();
275
+ // Control Case Instances
276
+ await sdk.maestro.cases.instances.close(instanceId, 'folder-key', {
277
+ comment: 'Case resolved successfully'
278
+ });
176
279
 
177
- // Get a specific process and start it
178
- const process = await sdk.processes.getAll({
179
- filter: "name eq 'MyProcess'"
280
+ // Orchestrator Processes - Start a process
281
+ const result = await sdk.processes.start({
282
+ processKey: 'MyProcess_Key',
283
+ }, folderId);
284
+
285
+ // Tasks - Create, assign, and complete
286
+ const task = await sdk.tasks.create({
287
+ title: 'Review Invoice',
288
+ priority: 'High'
289
+ }, folderId);
290
+
291
+ await sdk.tasks.assign({
292
+ taskId: task.id,
293
+ userNameOrEmail: 'user@company.com'
294
+ }, folderId);
295
+
296
+ await sdk.tasks.complete(TaskType.App, {
297
+ taskId: task.id,
298
+ data: {},
299
+ action: 'submit'
300
+ }, folderId);
301
+
302
+ // Buckets - File operations
303
+ const bucket = await sdk.buckets.getById(bucketId, folderId);
304
+ const fileMetadata = await sdk.buckets.getFileMetaData(bucketId, folderId, {
305
+ prefix: '/invoices/'
180
306
  });
181
- const job = await sdk.processes.start({
182
- processKey: process[0].key
183
- }, 'folder-id');
184
307
 
185
- // Get all queues
186
- const queues = await sdk.queues.getAll();
308
+ // Upload file
309
+ await sdk.buckets.uploadFile({
310
+ bucketId: bucketId,
311
+ folderId: folderId,
312
+ prefix: '/folder1'
313
+ });
187
314
 
188
- // Get all assets
189
- const assets = await sdk.assets.getAll();
190
- //Get assets in a folder
191
- const assets = await sdk.assets.getAll({folderId: 'folder-id'});
192
- ```
315
+ // Get download URL
316
+ const downloadUrl = await sdk.buckets.getReadUri({
317
+ bucketId: bucketId,
318
+ folderId: folderId,
319
+ path: '/folder/file.pdf'
320
+ });
193
321
 
194
- ## TypeScript Support
322
+ // Data Fabric Entities - CRUD operations
323
+ const entity = await sdk.entities.getById('entity-uuid');
324
+ const records = await sdk.entities.getRecordsById('entity-uuid', {
325
+ pageSize: 100,
326
+ expansionLevel: 1
327
+ });
195
328
 
196
- The SDK is fully typed and exports all types for better developer experience and LLM-friendly coding:
329
+ // Insert records
330
+ await sdk.entities.insertById('entity-uuid', [
331
+ { name: 'John Doe', email: 'john@company.com', status: 'Active' },
332
+ { name: 'Jane Smith', email: 'jane@company.com', status: 'Active' }
333
+ ]);
197
334
 
198
- ```typescript
199
- import {
200
- UiPath,
201
- // Task types
202
- TaskCreateOptions,
203
- TaskPriority,
204
- TaskStatus,
205
-
206
- // Process types
207
- ProcessStartRequest,
208
- ProcessStartResponse,
209
- ProcessGetResponse,
210
-
211
- // Entity types
212
- EntityGetResponse,
213
- EntityInsertOptions,
214
-
215
- // Asset/Queue/Bucket types
216
- AssetGetResponse,
217
- QueueGetResponse,
218
- BucketGetResponse,
219
-
220
- // Maestro types
221
- ProcessInstanceGetResponse,
222
- MaestroProcessGetAllResponse
223
- } from '@uipath/uipath-typescript';
224
-
225
- // TypeScript will provide full intellisense
226
- const taskOptions: TaskCreateOptions = {
227
- title: 'Review Document',
228
- priority: TaskPriority.High
229
- };
335
+ // Update records
336
+ await sdk.entities.updateById('entity-uuid', [
337
+ { Id: 'record-id-1', status: 'Inactive' }
338
+ ]);
230
339
 
231
- const task = await sdk.tasks.create(taskOptions);
340
+ // Delete records
341
+ await sdk.entities.deleteById('entity-uuid', ['record-id-1', 'record-id-2']);
232
342
  ```
233
343
 
234
- ## Error Handling
344
+ </details>
235
345
 
236
- The SDK provides comprehensive error handling with typed errors:
237
-
238
- ```typescript
239
- import { UiPathError } from '@uipath/uipath-typescript';
346
+ <div align="right">
240
347
 
241
- try {
242
- const process = await sdk.maestro.processes.getById('invalid-id');
243
- } catch (error) {
244
- if (error instanceof UiPathError) {
245
- // Access common error properties
246
- console.log('Error Type:', error.type);
247
- console.log('Message:', error.message);
248
- console.log('Status Code:', error.statusCode);
249
- console.log('Request ID:', error.requestId);
250
- console.log('Timestamp:', error.timestamp);
251
- console.log('error stack trace:', error.stack);
252
-
253
- // Get detailed debug information including stack trace
254
- const debugInfo = error.getDebugInfo();
255
- }
256
- }
257
- ```
348
+ [↑ Back to top](#uipath-typescript-sdk)
258
349
 
259
- ## Pagination
350
+ </div>
260
351
 
261
- The SDK provides built-in pagination support:
352
+ ## Samples
262
353
 
263
- ### Cursor-based Navigation
354
+ Check out the [`/samples`](./samples) folder to see sample applications built using the SDK:
264
355
 
265
- ```typescript
266
- // Navigate through pages using cursors
267
- let currentPage = await sdk.assets.getAll({ pageSize: 10 }) as PaginatedResponse<AssetGetResponse>;
356
+ - **[process-app](./samples/process-app)**: A Maestro process management application demonstrating OAuth authentication and SDK usage
268
357
 
269
- while (currentPage.hasNextPage) {
270
- // Process current page items
271
- currentPage.items.forEach(item => console.log(item.name));
272
-
273
- // Get next page using cursor
274
- currentPage = await sdk.assets.getAll({
275
- cursor: currentPage.nextCursor
276
- }) as PaginatedResponse<AssetGetResponse>;
277
- }
278
- ```
358
+ <div align="right">
279
359
 
280
- ### Page Jumping
360
+ [↑ Back to top](#uipath-typescript-sdk)
281
361
 
282
- ```typescript
283
- // Jump directly to page 5 (when supported)
284
- const page5 = await sdk.assets.getAll({
285
- jumpToPage: 5,
286
- pageSize: 20
287
- });
362
+ </div>
288
363
 
289
- // Check if page jumping is supported
290
- if (page5.supportsPageJump) {
291
- console.log(`Currently on page ${page5.currentPage} of ${page5.totalPages}`);
292
- }
293
- ```
294
-
295
- ## Samples
364
+ ## Development
296
365
 
297
- Check out the [`/samples`](./samples) folder to see sample applications built using the SDK:
366
+ Before submitting a pull request, please review our [Contribution Guidelines](https://uipath.github.io/uipath-typescript/CONTRIBUTING/).
298
367
 
299
- - **[process-app](./samples/process-app)**: A Maestro process management application demonstrating OAuth authentication and SDK usage
368
+ <div align="right">
300
369
 
301
- ## Development
370
+ [↑ Back to top](#uipath-typescript-sdk)
302
371
 
303
- Before submitting a pull request, please review our [Contribution Guidelines](https://uipath.github.io/uipath-typescript/CONTRIBUTING/).
372
+ </div>