@uipath/uipath-typescript 1.0.0-beta.13 → 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 ADDED
@@ -0,0 +1,372 @@
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
+
12
+ # UiPath TypeScript SDK
13
+
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)
21
+
22
+ A comprehensive TypeScript SDK for interacting with UiPath Platform services.
23
+
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
61
+
62
+ ```bash
63
+ # Using npm
64
+ npm install @uipath/uipath-typescript
65
+
66
+ # Using yarn
67
+ yarn add @uipath/uipath-typescript
68
+
69
+ # Using pnpm
70
+ pnpm add @uipath/uipath-typescript
71
+ ```
72
+
73
+ ### Quick Start
74
+
75
+ ```typescript
76
+ import { UiPath } from '@uipath/uipath-typescript';
77
+
78
+ // Initialize the SDK with OAuth
79
+ const sdk = new UiPath({
80
+ baseUrl: 'https://cloud.uipath.com',
81
+ orgName: 'your-organization',
82
+ tenantName: 'your-tenant',
83
+ clientId: 'your-client-id',
84
+ redirectUri: 'your-redirect-uri',
85
+ scope: 'your-scopes'
86
+ });
87
+
88
+ // Initialize OAuth flow
89
+ await sdk.initialize();
90
+
91
+ // Use the services
92
+ const processes = await sdk.maestro.processes.getAll();
93
+ const tasks = await sdk.tasks.getAll();
94
+ ```
95
+
96
+ <div align="right">
97
+
98
+ [↑ Back to top](#uipath-typescript-sdk)
99
+
100
+ </div>
101
+
102
+ ## Authentication
103
+
104
+ ### Authentication Methods
105
+
106
+ The SDK supports two authentication methods:
107
+
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.
109
+
110
+ <details>
111
+ <summary><strong>1. OAuth Authentication (Recommended)</strong></summary>
112
+
113
+ ```typescript
114
+ const sdk = new UiPath({
115
+ baseUrl: 'https://cloud.uipath.com',
116
+ orgName: 'your-organization',
117
+ tenantName: 'your-tenant',
118
+ clientId: 'your-client-id',
119
+ redirectUri: 'your-redirect-uri',
120
+ scope: 'your-scopes'
121
+ });
122
+
123
+ // IMPORTANT: OAuth requires calling initialize()
124
+ await sdk.initialize();
125
+ ```
126
+
127
+ </details>
128
+
129
+ <details>
130
+ <summary><strong>2. Secret-based Authentication</strong></summary>
131
+
132
+ ```typescript
133
+ const sdk = new UiPath({
134
+ baseUrl: 'https://cloud.uipath.com',
135
+ orgName: 'your-organization',
136
+ tenantName: 'your-tenant',
137
+ secret: 'your-secret' //PAT Token or Bearer Token
138
+ });
139
+ ```
140
+
141
+ </details>
142
+
143
+ ### SDK Initialization
144
+
145
+ <details>
146
+ <summary><strong>When to Use initialize()</strong></summary>
147
+
148
+ The `initialize()` method completes the authentication process for the SDK:
149
+
150
+ - **Secret Authentication**: Auto-initializes when creating the SDK instance - **no need to call initialize()**
151
+ - **OAuth Authentication**: **MUST call** `await sdk.initialize()` before using any SDK services
152
+
153
+ #### Example: Secret Authentication (Auto-initialized)
154
+ ```typescript
155
+ const sdk = new UiPath({
156
+ baseUrl: 'https://cloud.uipath.com',
157
+ orgName: 'your-organization',
158
+ tenantName: 'your-tenant',
159
+ secret: 'your-secret' //PAT Token or Bearer Token
160
+ });
161
+
162
+ // Ready to use immediately - no initialize() needed
163
+ const tasks = await sdk.tasks.getAll();
164
+ ```
165
+
166
+ #### Example: OAuth Authentication (Requires initialize)
167
+ ```typescript
168
+ const sdk = new UiPath({
169
+ baseUrl: 'https://cloud.uipath.com',
170
+ orgName: 'your-organization',
171
+ tenantName: 'your-tenant',
172
+ clientId: 'your-client-id',
173
+ redirectUri: 'http://localhost:3000',
174
+ scope: 'your-scopes'
175
+ });
176
+
177
+ // Must initialize before using services
178
+ try {
179
+ await sdk.initialize();
180
+ console.log('SDK initialized successfully');
181
+
182
+ // Now you can use the SDK
183
+ const tasks = await sdk.tasks.getAll();
184
+ } catch (error) {
185
+ console.error('Failed to initialize SDK:', error);
186
+ }
187
+ ```
188
+
189
+ </details>
190
+
191
+ ### OAuth Integration Patterns
192
+
193
+ <details>
194
+ <summary><strong>View Integration Patterns</strong></summary>
195
+
196
+ #### Auto-login on App Load
197
+ ```typescript
198
+ useEffect(() => {
199
+ const initSDK = async () => {
200
+ const sdk = new UiPath({...oauthConfig});
201
+ await sdk.initialize();
202
+ };
203
+ initSDK();
204
+ }, []);
205
+ ```
206
+
207
+ #### User-Triggered Login
208
+ ```typescript
209
+ const onLogin = async () => {
210
+ await sdk.initialize();
211
+ };
212
+
213
+ // Handle OAuth callback
214
+ const oauthCompleted = useRef(false);
215
+ useEffect(() => {
216
+ if (sdk.isInitialized() && !oauthCompleted.current) {
217
+ oauthCompleted.current = true;
218
+ sdk.completeOAuth();
219
+ }
220
+ }, []);
221
+ ```
222
+
223
+ #### Available OAuth Methods
224
+ - `sdk.initialize()` - Start OAuth flow (auto completes also based on callback state)
225
+ - `sdk.isInitialized()` - Check if SDK initialization completed
226
+ - `sdk.isAuthenticated()` - Check if user has valid token
227
+ - `sdk.isInOAuthCallback()` - Check if processing OAuth redirect
228
+ - `sdk.completeOAuth()` - Manually complete OAuth (advanced use)
229
+
230
+ </details>
231
+
232
+ <div align="right">
233
+
234
+ [↑ Back to top](#uipath-typescript-sdk)
235
+
236
+ </div>
237
+
238
+ ## Usage
239
+
240
+ The SDK provides access to the following services through a consistent API:
241
+
242
+ - `sdk.maestro.processes` - Manage agentic maestro processes
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
246
+ - `sdk.tasks` - Create and manage tasks
247
+ - `sdk.entities` - Data Fabric entity operations
248
+ - `sdk.processes` - Manage Orchestrator processes
249
+ - `sdk.buckets` - Manage storage buckets in Orchestrator
250
+ - `sdk.queues` - Manage Orchestrator queues
251
+ - `sdk.assets` - Manage Orchestrator assets
252
+
253
+ <details>
254
+ <summary><strong>View Example Usage</strong></summary>
255
+
256
+ ```typescript
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
+ });
263
+
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
+ });
270
+
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');
274
+
275
+ // Control Case Instances
276
+ await sdk.maestro.cases.instances.close(instanceId, 'folder-key', {
277
+ comment: 'Case resolved successfully'
278
+ });
279
+
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/'
306
+ });
307
+
308
+ // Upload file
309
+ await sdk.buckets.uploadFile({
310
+ bucketId: bucketId,
311
+ folderId: folderId,
312
+ prefix: '/folder1'
313
+ });
314
+
315
+ // Get download URL
316
+ const downloadUrl = await sdk.buckets.getReadUri({
317
+ bucketId: bucketId,
318
+ folderId: folderId,
319
+ path: '/folder/file.pdf'
320
+ });
321
+
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
+ });
328
+
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
+ ]);
334
+
335
+ // Update records
336
+ await sdk.entities.updateById('entity-uuid', [
337
+ { Id: 'record-id-1', status: 'Inactive' }
338
+ ]);
339
+
340
+ // Delete records
341
+ await sdk.entities.deleteById('entity-uuid', ['record-id-1', 'record-id-2']);
342
+ ```
343
+
344
+ </details>
345
+
346
+ <div align="right">
347
+
348
+ [↑ Back to top](#uipath-typescript-sdk)
349
+
350
+ </div>
351
+
352
+ ## Samples
353
+
354
+ Check out the [`/samples`](./samples) folder to see sample applications built using the SDK:
355
+
356
+ - **[process-app](./samples/process-app)**: A Maestro process management application demonstrating OAuth authentication and SDK usage
357
+
358
+ <div align="right">
359
+
360
+ [↑ Back to top](#uipath-typescript-sdk)
361
+
362
+ </div>
363
+
364
+ ## Development
365
+
366
+ Before submitting a pull request, please review our [Contribution Guidelines](https://uipath.github.io/uipath-typescript/CONTRIBUTING/).
367
+
368
+ <div align="right">
369
+
370
+ [↑ Back to top](#uipath-typescript-sdk)
371
+
372
+ </div>