uipath 2.0.59__py3-none-any.whl → 2.0.60__py3-none-any.whl
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.
Potentially problematic release.
This version of uipath might be problematic. Click here for more details.
- uipath/_cli/_utils/_constants.py +1 -0
- uipath/_cli/_utils/_parse_ast.py +29 -48
- uipath/_cli/cli_init.py +4 -0
- uipath/_services/assets_service.py +83 -106
- uipath/_services/buckets_service.py +69 -4
- uipath/_services/context_grounding_service.py +5 -1
- uipath/_services/processes_service.py +2 -1
- uipath/_utils/_infer_bindings.py +19 -3
- uipath/_utils/_read_overwrites.py +20 -17
- uipath/_utils/constants.py +0 -3
- {uipath-2.0.59.dist-info → uipath-2.0.60.dist-info}/METADATA +1 -1
- {uipath-2.0.59.dist-info → uipath-2.0.60.dist-info}/RECORD +15 -14
- {uipath-2.0.59.dist-info → uipath-2.0.60.dist-info}/WHEEL +0 -0
- {uipath-2.0.59.dist-info → uipath-2.0.60.dist-info}/entry_points.txt +0 -0
- {uipath-2.0.59.dist-info → uipath-2.0.60.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
BINDINGS_VERSION = "2.2"
|
uipath/_cli/_utils/_parse_ast.py
CHANGED
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
import ast
|
|
4
4
|
import os
|
|
5
5
|
from dataclasses import dataclass, field
|
|
6
|
-
from typing import Any, Dict, List, Optional
|
|
7
|
-
|
|
8
|
-
from ..._services import
|
|
6
|
+
from typing import Any, Dict, List, Optional, Tuple
|
|
7
|
+
|
|
8
|
+
from ..._services import (
|
|
9
|
+
AssetsService,
|
|
10
|
+
BucketsService,
|
|
11
|
+
ContextGroundingService,
|
|
12
|
+
ProcessesService,
|
|
13
|
+
)
|
|
9
14
|
from ..._utils import get_inferred_bindings_names
|
|
15
|
+
from ._constants import BINDINGS_VERSION
|
|
10
16
|
|
|
11
17
|
|
|
12
18
|
@dataclass
|
|
@@ -33,6 +39,14 @@ service_name_resource_mapping = {
|
|
|
33
39
|
"processes": "process",
|
|
34
40
|
"buckets": "bucket",
|
|
35
41
|
"connections": "connection",
|
|
42
|
+
"context_grounding": "index",
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
supported_bindings_by_service = {
|
|
46
|
+
"assets": AssetsService,
|
|
47
|
+
"processes": ProcessesService,
|
|
48
|
+
"buckets": BucketsService,
|
|
49
|
+
"context_grounding": ContextGroundingService,
|
|
36
50
|
}
|
|
37
51
|
|
|
38
52
|
|
|
@@ -67,48 +81,10 @@ class ServiceUsage:
|
|
|
67
81
|
def get_component_info(self) -> List[Dict[str, str]]:
|
|
68
82
|
"""Extract component names and folders based on the service type."""
|
|
69
83
|
result = []
|
|
70
|
-
|
|
71
|
-
if
|
|
72
|
-
for call in self.method_calls:
|
|
73
|
-
inferred_bindings = get_inferred_bindings_names(AssetsService)
|
|
74
|
-
if call.method_name in inferred_bindings:
|
|
75
|
-
name = extract_parameter(
|
|
76
|
-
call, inferred_bindings[call.method_name]["name"], 0
|
|
77
|
-
)
|
|
78
|
-
folder_path = extract_parameter(
|
|
79
|
-
call, inferred_bindings[call.method_name]["folder_path"]
|
|
80
|
-
)
|
|
81
|
-
if name:
|
|
82
|
-
result.append(
|
|
83
|
-
{
|
|
84
|
-
"name": name,
|
|
85
|
-
"folder": folder_path or "",
|
|
86
|
-
"method": call.method_name,
|
|
87
|
-
}
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
elif self.service_name == "processes":
|
|
91
|
-
for call in self.method_calls:
|
|
92
|
-
inferred_bindings = get_inferred_bindings_names(ProcessesService)
|
|
93
|
-
if call.method_name in inferred_bindings:
|
|
94
|
-
name = extract_parameter(
|
|
95
|
-
call, inferred_bindings[call.method_name]["name"], 0
|
|
96
|
-
)
|
|
97
|
-
folder_path = extract_parameter(
|
|
98
|
-
call, inferred_bindings[call.method_name]["folder_path"]
|
|
99
|
-
)
|
|
100
|
-
if name:
|
|
101
|
-
result.append(
|
|
102
|
-
{
|
|
103
|
-
"name": name,
|
|
104
|
-
"folder": folder_path or "",
|
|
105
|
-
"method": call.method_name,
|
|
106
|
-
}
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
elif self.service_name == "buckets":
|
|
84
|
+
has_support, service_cls = self._support_for_bindings_inference()
|
|
85
|
+
if has_support:
|
|
110
86
|
for call in self.method_calls:
|
|
111
|
-
inferred_bindings = get_inferred_bindings_names(
|
|
87
|
+
inferred_bindings = get_inferred_bindings_names(service_cls)
|
|
112
88
|
if call.method_name in inferred_bindings:
|
|
113
89
|
name = extract_parameter(
|
|
114
90
|
call, inferred_bindings[call.method_name]["name"], 0
|
|
@@ -125,9 +101,9 @@ class ServiceUsage:
|
|
|
125
101
|
}
|
|
126
102
|
)
|
|
127
103
|
|
|
104
|
+
# custom logic for connections bindings
|
|
128
105
|
elif self.service_name == "connections":
|
|
129
106
|
for call in self.method_calls:
|
|
130
|
-
connection_id = None
|
|
131
107
|
if len(call.args) > 0:
|
|
132
108
|
connection_id = call.args[0]
|
|
133
109
|
if connection_id:
|
|
@@ -141,6 +117,12 @@ class ServiceUsage:
|
|
|
141
117
|
|
|
142
118
|
return result
|
|
143
119
|
|
|
120
|
+
def _support_for_bindings_inference(self) -> Tuple[bool, Any]:
|
|
121
|
+
return (
|
|
122
|
+
self.service_name in supported_bindings_by_service,
|
|
123
|
+
supported_bindings_by_service.get(self.service_name, None),
|
|
124
|
+
)
|
|
125
|
+
|
|
144
126
|
|
|
145
127
|
def extract_parameter(
|
|
146
128
|
method_call: ServiceMethodCall,
|
|
@@ -462,11 +444,10 @@ def convert_to_bindings_format(sdk_usage_data):
|
|
|
462
444
|
"defaultValue": connection_id,
|
|
463
445
|
"isExpression": is_connection_id_expression,
|
|
464
446
|
"displayName": "Connection",
|
|
465
|
-
"description": "The connection to be used",
|
|
466
447
|
}
|
|
467
448
|
},
|
|
468
449
|
"metadata": {
|
|
469
|
-
"BindingsVersion":
|
|
450
|
+
"BindingsVersion": BINDINGS_VERSION,
|
|
470
451
|
"Connector": connector_name,
|
|
471
452
|
"UseConnectionService": "True",
|
|
472
453
|
},
|
|
@@ -500,7 +481,7 @@ def convert_to_bindings_format(sdk_usage_data):
|
|
|
500
481
|
},
|
|
501
482
|
"metadata": {
|
|
502
483
|
"ActivityName": method_name,
|
|
503
|
-
"BindingsVersion":
|
|
484
|
+
"BindingsVersion": BINDINGS_VERSION,
|
|
504
485
|
"DisplayLabel": "FullName",
|
|
505
486
|
},
|
|
506
487
|
}
|
uipath/_cli/cli_init.py
CHANGED
|
@@ -6,6 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
from typing import Optional
|
|
7
7
|
|
|
8
8
|
import click
|
|
9
|
+
from dotenv import load_dotenv
|
|
9
10
|
|
|
10
11
|
from ..telemetry import track
|
|
11
12
|
from ._utils._console import ConsoleLogger
|
|
@@ -56,6 +57,9 @@ def get_user_script(directory: str, entrypoint: Optional[str] = None) -> Optiona
|
|
|
56
57
|
@track
|
|
57
58
|
def init(entrypoint: str) -> None:
|
|
58
59
|
"""Create uipath.json with input/output schemas and bindings."""
|
|
60
|
+
current_path = os.getcwd()
|
|
61
|
+
load_dotenv(os.path.join(current_path, ".env"), override=True)
|
|
62
|
+
|
|
59
63
|
with console.spinner("Initializing UiPath project ..."):
|
|
60
64
|
current_directory = os.getcwd()
|
|
61
65
|
generate_env_file(current_directory)
|
|
@@ -6,7 +6,7 @@ from .._config import Config
|
|
|
6
6
|
from .._execution_context import ExecutionContext
|
|
7
7
|
from .._folder_context import FolderContext
|
|
8
8
|
from .._utils import Endpoint, RequestSpec, header_folder, infer_bindings
|
|
9
|
-
from .._utils._read_overwrites import OverwritesManager
|
|
9
|
+
from .._utils._read_overwrites import OverwritesManager
|
|
10
10
|
from ..models import Asset, UserAsset
|
|
11
11
|
from ..tracing._traced import traced
|
|
12
12
|
from ._base_service import BaseService
|
|
@@ -24,10 +24,10 @@ class AssetsService(FolderContext, BaseService):
|
|
|
24
24
|
self._overwrites_manager = OverwritesManager()
|
|
25
25
|
self._base_url = "assets"
|
|
26
26
|
|
|
27
|
-
@infer_bindings()
|
|
28
27
|
@traced(
|
|
29
28
|
name="assets_retrieve", run_type="uipath", hide_input=True, hide_output=True
|
|
30
29
|
)
|
|
30
|
+
@infer_bindings(resource_type="asset")
|
|
31
31
|
def retrieve(
|
|
32
32
|
self,
|
|
33
33
|
name: str,
|
|
@@ -61,31 +61,28 @@ class AssetsService(FolderContext, BaseService):
|
|
|
61
61
|
except ValueError:
|
|
62
62
|
is_user = False
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
params=spec.params,
|
|
77
|
-
content=spec.content,
|
|
78
|
-
headers=spec.headers,
|
|
79
|
-
)
|
|
64
|
+
spec = self._retrieve_spec(
|
|
65
|
+
name,
|
|
66
|
+
folder_key=folder_key,
|
|
67
|
+
folder_path=folder_path,
|
|
68
|
+
)
|
|
69
|
+
response = self.request(
|
|
70
|
+
spec.method,
|
|
71
|
+
url=spec.endpoint,
|
|
72
|
+
params=spec.params,
|
|
73
|
+
content=spec.content,
|
|
74
|
+
headers=spec.headers,
|
|
75
|
+
)
|
|
80
76
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
if is_user:
|
|
78
|
+
return UserAsset.model_validate(response.json())
|
|
79
|
+
else:
|
|
80
|
+
return Asset.model_validate(response.json()["value"][0])
|
|
85
81
|
|
|
86
82
|
@traced(
|
|
87
83
|
name="assets_retrieve", run_type="uipath", hide_input=True, hide_output=True
|
|
88
84
|
)
|
|
85
|
+
@infer_bindings(resource_type="asset")
|
|
89
86
|
async def retrieve_async(
|
|
90
87
|
self,
|
|
91
88
|
name: str,
|
|
@@ -110,32 +107,28 @@ class AssetsService(FolderContext, BaseService):
|
|
|
110
107
|
except ValueError:
|
|
111
108
|
is_user = False
|
|
112
109
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
params=spec.params,
|
|
126
|
-
content=spec.content,
|
|
127
|
-
headers=spec.headers,
|
|
128
|
-
)
|
|
110
|
+
spec = self._retrieve_spec(
|
|
111
|
+
name,
|
|
112
|
+
folder_key=folder_key,
|
|
113
|
+
folder_path=folder_path,
|
|
114
|
+
)
|
|
115
|
+
response = await self.request_async(
|
|
116
|
+
spec.method,
|
|
117
|
+
url=spec.endpoint,
|
|
118
|
+
params=spec.params,
|
|
119
|
+
content=spec.content,
|
|
120
|
+
headers=spec.headers,
|
|
121
|
+
)
|
|
129
122
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
if is_user:
|
|
124
|
+
return UserAsset.model_validate(response.json())
|
|
125
|
+
else:
|
|
126
|
+
return Asset.model_validate(response.json()["value"][0])
|
|
134
127
|
|
|
135
|
-
@infer_bindings()
|
|
136
128
|
@traced(
|
|
137
129
|
name="assets_credential", run_type="uipath", hide_input=True, hide_output=True
|
|
138
130
|
)
|
|
131
|
+
@infer_bindings(resource_type="asset")
|
|
139
132
|
def retrieve_credential(
|
|
140
133
|
self,
|
|
141
134
|
name: str,
|
|
@@ -168,31 +161,27 @@ class AssetsService(FolderContext, BaseService):
|
|
|
168
161
|
if not is_user:
|
|
169
162
|
raise ValueError("This method can only be used for robot assets.")
|
|
170
163
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
overwritten_name,
|
|
177
|
-
folder_key=folder_key,
|
|
178
|
-
folder_path=overwritten_folder_path,
|
|
179
|
-
)
|
|
164
|
+
spec = self._retrieve_spec(
|
|
165
|
+
name,
|
|
166
|
+
folder_key=folder_key,
|
|
167
|
+
folder_path=folder_path,
|
|
168
|
+
)
|
|
180
169
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
170
|
+
response = self.request(
|
|
171
|
+
spec.method,
|
|
172
|
+
url=spec.endpoint,
|
|
173
|
+
content=spec.content,
|
|
174
|
+
headers=spec.headers,
|
|
175
|
+
)
|
|
187
176
|
|
|
188
|
-
|
|
177
|
+
user_asset = UserAsset.model_validate(response.json())
|
|
189
178
|
|
|
190
|
-
|
|
179
|
+
return user_asset.credential_password
|
|
191
180
|
|
|
192
|
-
@infer_bindings()
|
|
193
181
|
@traced(
|
|
194
182
|
name="assets_credential", run_type="uipath", hide_input=True, hide_output=True
|
|
195
183
|
)
|
|
184
|
+
@infer_bindings(resource_type="asset")
|
|
196
185
|
async def retrieve_credential_async(
|
|
197
186
|
self,
|
|
198
187
|
name: str,
|
|
@@ -225,26 +214,22 @@ class AssetsService(FolderContext, BaseService):
|
|
|
225
214
|
if not is_user:
|
|
226
215
|
raise ValueError("This method can only be used for robot assets.")
|
|
227
216
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
overwritten_name,
|
|
234
|
-
folder_key=folder_key,
|
|
235
|
-
folder_path=overwritten_folder_path,
|
|
236
|
-
)
|
|
217
|
+
spec = self._retrieve_spec(
|
|
218
|
+
name,
|
|
219
|
+
folder_key=folder_key,
|
|
220
|
+
folder_path=folder_path,
|
|
221
|
+
)
|
|
237
222
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
223
|
+
response = await self.request_async(
|
|
224
|
+
spec.method,
|
|
225
|
+
url=spec.endpoint,
|
|
226
|
+
content=spec.content,
|
|
227
|
+
headers=spec.headers,
|
|
228
|
+
)
|
|
244
229
|
|
|
245
|
-
|
|
230
|
+
user_asset = UserAsset.model_validate(response.json())
|
|
246
231
|
|
|
247
|
-
|
|
232
|
+
return user_asset.credential_password
|
|
248
233
|
|
|
249
234
|
@traced(name="assets_update", run_type="uipath", hide_input=True, hide_output=True)
|
|
250
235
|
def update(
|
|
@@ -275,22 +260,18 @@ class AssetsService(FolderContext, BaseService):
|
|
|
275
260
|
if not is_user:
|
|
276
261
|
raise ValueError("This method can only be used for robot assets.")
|
|
277
262
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
):
|
|
282
|
-
spec = self._update_spec(
|
|
283
|
-
robot_asset, folder_key=folder_key, folder_path=overwritten_folder_path
|
|
284
|
-
)
|
|
263
|
+
spec = self._update_spec(
|
|
264
|
+
robot_asset, folder_key=folder_key, folder_path=folder_path
|
|
265
|
+
)
|
|
285
266
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
267
|
+
response = self.request(
|
|
268
|
+
spec.method,
|
|
269
|
+
url=spec.endpoint,
|
|
270
|
+
content=spec.content,
|
|
271
|
+
headers=spec.headers,
|
|
272
|
+
)
|
|
292
273
|
|
|
293
|
-
|
|
274
|
+
return response.json()
|
|
294
275
|
|
|
295
276
|
@traced(name="assets_update", run_type="uipath", hide_input=True, hide_output=True)
|
|
296
277
|
async def update_async(
|
|
@@ -310,22 +291,18 @@ class AssetsService(FolderContext, BaseService):
|
|
|
310
291
|
Returns:
|
|
311
292
|
Response: The HTTP response confirming the update.
|
|
312
293
|
"""
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
):
|
|
317
|
-
spec = self._update_spec(
|
|
318
|
-
robot_asset, folder_key=folder_key, folder_path=overwritten_folder_path
|
|
319
|
-
)
|
|
294
|
+
spec = self._update_spec(
|
|
295
|
+
robot_asset, folder_key=folder_key, folder_path=folder_path
|
|
296
|
+
)
|
|
320
297
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
298
|
+
response = await self.request_async(
|
|
299
|
+
spec.method,
|
|
300
|
+
url=spec.endpoint,
|
|
301
|
+
content=spec.content,
|
|
302
|
+
headers=spec.headers,
|
|
303
|
+
)
|
|
327
304
|
|
|
328
|
-
|
|
305
|
+
return response.json()
|
|
329
306
|
|
|
330
307
|
@property
|
|
331
308
|
def custom_headers(self) -> Dict[str, str]:
|
|
@@ -29,6 +29,7 @@ class BucketsService(FolderContext, BaseService):
|
|
|
29
29
|
self.custom_client_async = httpx.AsyncClient()
|
|
30
30
|
|
|
31
31
|
@traced(name="buckets_download", run_type="uipath")
|
|
32
|
+
@infer_bindings(resource_type="bucket")
|
|
32
33
|
def download(
|
|
33
34
|
self,
|
|
34
35
|
*,
|
|
@@ -83,7 +84,70 @@ class BucketsService(FolderContext, BaseService):
|
|
|
83
84
|
file_content = self.custom_client.get(read_uri, headers=headers).content
|
|
84
85
|
file.write(file_content)
|
|
85
86
|
|
|
87
|
+
@traced(name="buckets_download", run_type="uipath")
|
|
88
|
+
@infer_bindings(resource_type="bucket")
|
|
89
|
+
async def download_async(
|
|
90
|
+
self,
|
|
91
|
+
*,
|
|
92
|
+
name: Optional[str] = None,
|
|
93
|
+
key: Optional[str] = None,
|
|
94
|
+
blob_file_path: str,
|
|
95
|
+
destination_path: str,
|
|
96
|
+
folder_key: Optional[str] = None,
|
|
97
|
+
folder_path: Optional[str] = None,
|
|
98
|
+
) -> None:
|
|
99
|
+
"""Download a file from a bucket asynchronously.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
key (Optional[str]): The key of the bucket.
|
|
103
|
+
name (Optional[str]): The name of the bucket.
|
|
104
|
+
blob_file_path (str): The path to the file in the bucket.
|
|
105
|
+
destination_path (str): The local path where the file will be saved.
|
|
106
|
+
folder_key (Optional[str]): The key of the folder where the bucket resides.
|
|
107
|
+
folder_path (Optional[str]): The path of the folder where the bucket resides.
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
ValueError: If neither key nor name is provided.
|
|
111
|
+
Exception: If the bucket with the specified key is not found.
|
|
112
|
+
"""
|
|
113
|
+
bucket = await self.retrieve_async(
|
|
114
|
+
name=name, key=key, folder_key=folder_key, folder_path=folder_path
|
|
115
|
+
)
|
|
116
|
+
spec = self._retrieve_readUri_spec(
|
|
117
|
+
bucket.id, blob_file_path, folder_key=folder_key, folder_path=folder_path
|
|
118
|
+
)
|
|
119
|
+
result = (
|
|
120
|
+
await self.request_async(
|
|
121
|
+
spec.method,
|
|
122
|
+
url=spec.endpoint,
|
|
123
|
+
params=spec.params,
|
|
124
|
+
headers=spec.headers,
|
|
125
|
+
)
|
|
126
|
+
).json()
|
|
127
|
+
|
|
128
|
+
read_uri = result["Uri"]
|
|
129
|
+
|
|
130
|
+
headers = {
|
|
131
|
+
key: value
|
|
132
|
+
for key, value in zip(
|
|
133
|
+
result["Headers"]["Keys"], result["Headers"]["Values"], strict=False
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
with open(destination_path, "wb") as file:
|
|
138
|
+
# the self.request adds auth bearer token
|
|
139
|
+
if result["RequiresAuth"]:
|
|
140
|
+
file_content = (
|
|
141
|
+
await self.request_async("GET", read_uri, headers=headers)
|
|
142
|
+
).content
|
|
143
|
+
else:
|
|
144
|
+
file_content = (
|
|
145
|
+
await self.custom_client_async.get(read_uri, headers=headers)
|
|
146
|
+
).content
|
|
147
|
+
file.write(file_content)
|
|
148
|
+
|
|
86
149
|
@traced(name="buckets_upload", run_type="uipath")
|
|
150
|
+
@infer_bindings(resource_type="bucket")
|
|
87
151
|
def upload(
|
|
88
152
|
self,
|
|
89
153
|
*,
|
|
@@ -166,6 +230,7 @@ class BucketsService(FolderContext, BaseService):
|
|
|
166
230
|
)
|
|
167
231
|
|
|
168
232
|
@traced(name="buckets_upload", run_type="uipath")
|
|
233
|
+
@infer_bindings(resource_type="bucket")
|
|
169
234
|
async def upload_async(
|
|
170
235
|
self,
|
|
171
236
|
*,
|
|
@@ -252,8 +317,8 @@ class BucketsService(FolderContext, BaseService):
|
|
|
252
317
|
write_uri, headers=headers, files={"file": file}
|
|
253
318
|
)
|
|
254
319
|
|
|
255
|
-
@infer_bindings()
|
|
256
320
|
@traced(name="buckets_retrieve", run_type="uipath")
|
|
321
|
+
@infer_bindings(resource_type="bucket")
|
|
257
322
|
def retrieve(
|
|
258
323
|
self,
|
|
259
324
|
*,
|
|
@@ -300,8 +365,8 @@ class BucketsService(FolderContext, BaseService):
|
|
|
300
365
|
raise Exception(f"Bucket with name '{name}' not found") from e
|
|
301
366
|
return Bucket.model_validate(response)
|
|
302
367
|
|
|
303
|
-
@infer_bindings()
|
|
304
368
|
@traced(name="buckets_retrieve", run_type="uipath")
|
|
369
|
+
@infer_bindings(resource_type="bucket")
|
|
305
370
|
async def retrieve_async(
|
|
306
371
|
self,
|
|
307
372
|
*,
|
|
@@ -372,7 +437,7 @@ class BucketsService(FolderContext, BaseService):
|
|
|
372
437
|
|
|
373
438
|
def _retrieve_readUri_spec(
|
|
374
439
|
self,
|
|
375
|
-
bucket_id:
|
|
440
|
+
bucket_id: int,
|
|
376
441
|
blob_file_path: str,
|
|
377
442
|
folder_key: Optional[str] = None,
|
|
378
443
|
folder_path: Optional[str] = None,
|
|
@@ -390,7 +455,7 @@ class BucketsService(FolderContext, BaseService):
|
|
|
390
455
|
|
|
391
456
|
def _retrieve_writeri_spec(
|
|
392
457
|
self,
|
|
393
|
-
bucket_id:
|
|
458
|
+
bucket_id: int,
|
|
394
459
|
content_type: str,
|
|
395
460
|
blob_file_path: str,
|
|
396
461
|
folder_key: Optional[str] = None,
|
|
@@ -8,7 +8,7 @@ from typing_extensions import deprecated
|
|
|
8
8
|
from .._config import Config
|
|
9
9
|
from .._execution_context import ExecutionContext
|
|
10
10
|
from .._folder_context import FolderContext
|
|
11
|
-
from .._utils import Endpoint, RequestSpec, header_folder
|
|
11
|
+
from .._utils import Endpoint, RequestSpec, header_folder, infer_bindings
|
|
12
12
|
from .._utils.constants import (
|
|
13
13
|
ORCHESTRATOR_STORAGE_BUCKET_DATA_SOURCE,
|
|
14
14
|
)
|
|
@@ -46,6 +46,7 @@ class ContextGroundingService(FolderContext, BaseService):
|
|
|
46
46
|
super().__init__(config=config, execution_context=execution_context)
|
|
47
47
|
|
|
48
48
|
@traced(name="add_to_index", run_type="uipath")
|
|
49
|
+
@infer_bindings(resource_type="index")
|
|
49
50
|
def add_to_index(
|
|
50
51
|
self,
|
|
51
52
|
name: str,
|
|
@@ -96,6 +97,7 @@ class ContextGroundingService(FolderContext, BaseService):
|
|
|
96
97
|
self.ingest_data(index, folder_key=folder_key, folder_path=folder_path)
|
|
97
98
|
|
|
98
99
|
@traced(name="add_to_index", run_type="uipath")
|
|
100
|
+
@infer_bindings(resource_type="index")
|
|
99
101
|
async def add_to_index_async(
|
|
100
102
|
self,
|
|
101
103
|
name: str,
|
|
@@ -151,6 +153,7 @@ class ContextGroundingService(FolderContext, BaseService):
|
|
|
151
153
|
)
|
|
152
154
|
|
|
153
155
|
@traced(name="contextgrounding_retrieve", run_type="uipath")
|
|
156
|
+
@infer_bindings(resource_type="index")
|
|
154
157
|
def retrieve(
|
|
155
158
|
self,
|
|
156
159
|
name: str,
|
|
@@ -192,6 +195,7 @@ class ContextGroundingService(FolderContext, BaseService):
|
|
|
192
195
|
raise Exception("ContextGroundingIndex not found") from e
|
|
193
196
|
|
|
194
197
|
@traced(name="contextgrounding_retrieve", run_type="uipath")
|
|
198
|
+
@infer_bindings(resource_type="index")
|
|
195
199
|
async def retrieve_async(
|
|
196
200
|
self,
|
|
197
201
|
name: str,
|
|
@@ -24,6 +24,7 @@ class ProcessesService(FolderContext, BaseService):
|
|
|
24
24
|
super().__init__(config=config, execution_context=execution_context)
|
|
25
25
|
|
|
26
26
|
@traced(name="processes_invoke", run_type="uipath")
|
|
27
|
+
@infer_bindings(resource_type="process")
|
|
27
28
|
def invoke(
|
|
28
29
|
self,
|
|
29
30
|
name: str,
|
|
@@ -80,8 +81,8 @@ class ProcessesService(FolderContext, BaseService):
|
|
|
80
81
|
|
|
81
82
|
return Job.model_validate(response.json()["value"][0])
|
|
82
83
|
|
|
83
|
-
@infer_bindings()
|
|
84
84
|
@traced(name="processes_invoke", run_type="uipath")
|
|
85
|
+
@infer_bindings(resource_type="process")
|
|
85
86
|
async def invoke_async(
|
|
86
87
|
self,
|
|
87
88
|
name: str,
|
uipath/_utils/_infer_bindings.py
CHANGED
|
@@ -2,20 +2,36 @@ import functools
|
|
|
2
2
|
import inspect
|
|
3
3
|
from typing import Any, Callable, TypeVar
|
|
4
4
|
|
|
5
|
+
from ._read_overwrites import read_resource_overwrites
|
|
6
|
+
|
|
5
7
|
T = TypeVar("T")
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
def infer_bindings(
|
|
9
|
-
name: str = "name", folder_path: str = "folder_path"
|
|
11
|
+
resource_type: str, name: str = "name", folder_path: str = "folder_path"
|
|
10
12
|
) -> Callable[..., Any]:
|
|
11
13
|
def decorator(func: Callable[..., Any]):
|
|
12
14
|
@functools.wraps(func)
|
|
13
15
|
def wrapper(*args, **kwargs):
|
|
14
|
-
|
|
16
|
+
# convert both args and kwargs to single dict
|
|
17
|
+
sig = inspect.signature(func)
|
|
18
|
+
bound = sig.bind_partial(*args, **kwargs)
|
|
19
|
+
bound.apply_defaults()
|
|
20
|
+
all_args = dict(bound.arguments)
|
|
21
|
+
|
|
22
|
+
if name in all_args or folder_path in all_args:
|
|
23
|
+
with read_resource_overwrites(
|
|
24
|
+
resource_type,
|
|
25
|
+
all_args.get(name), # type: ignore
|
|
26
|
+
all_args.get(folder_path, None),
|
|
27
|
+
) as (name_overwrite_or_default, folder_path_overwrite_or_default):
|
|
28
|
+
all_args[name] = name_overwrite_or_default
|
|
29
|
+
all_args[folder_path] = folder_path_overwrite_or_default
|
|
30
|
+
|
|
31
|
+
return func(**all_args)
|
|
15
32
|
|
|
16
33
|
wrapper._should_infer_bindings = True # type: ignore
|
|
17
34
|
wrapper._infer_bindings_mappings = {"name": name, "folder_path": folder_path} # type: ignore
|
|
18
|
-
|
|
19
35
|
return wrapper
|
|
20
36
|
|
|
21
37
|
return decorator
|
|
@@ -16,8 +16,8 @@ class OverwritesManager:
|
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
_instance = None
|
|
19
|
-
_overwrites_file_path: Path = Path("uipath.json")
|
|
20
|
-
|
|
19
|
+
_overwrites_file_path: Path = Path("__uipath/uipath.json")
|
|
20
|
+
_runtime_overwrites: Dict[str, Any] = {}
|
|
21
21
|
|
|
22
22
|
def __new__(
|
|
23
23
|
cls, overwrites_file_path: Optional[Path] = None
|
|
@@ -56,12 +56,17 @@ class OverwritesManager:
|
|
|
56
56
|
"""
|
|
57
57
|
try:
|
|
58
58
|
with open(self._overwrites_file_path, "r") as f:
|
|
59
|
-
|
|
59
|
+
data = json.load(f)
|
|
60
|
+
self._runtime_overwrites = (
|
|
61
|
+
data.get("runtime", {})
|
|
62
|
+
.get("internalArguments", {})
|
|
63
|
+
.get("resourceOverwrites", {})
|
|
64
|
+
)
|
|
60
65
|
except FileNotFoundError:
|
|
61
|
-
self.
|
|
66
|
+
self._runtime_overwrites = {}
|
|
62
67
|
|
|
63
68
|
def get_overwrite(
|
|
64
|
-
self, resource_type: str, resource_name: str
|
|
69
|
+
self, resource_type: str, resource_name: str, folder_path: Optional[str] = None
|
|
65
70
|
) -> Optional[Tuple[str, str]]:
|
|
66
71
|
"""Get an overwrite value for a specific resource.
|
|
67
72
|
|
|
@@ -72,13 +77,15 @@ class OverwritesManager:
|
|
|
72
77
|
Returns:
|
|
73
78
|
A tuple of (name, folder_path) if found, None otherwise.
|
|
74
79
|
"""
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
if folder_path:
|
|
81
|
+
key = f"{resource_type}.{resource_name}.{folder_path}"
|
|
82
|
+
else:
|
|
83
|
+
key = f"{resource_type}.{resource_name}"
|
|
77
84
|
|
|
78
|
-
if key not in
|
|
85
|
+
if key not in self._runtime_overwrites:
|
|
79
86
|
return None
|
|
80
87
|
|
|
81
|
-
overwrite =
|
|
88
|
+
overwrite = self._runtime_overwrites[key]
|
|
82
89
|
return (
|
|
83
90
|
overwrite.get("name", resource_name),
|
|
84
91
|
overwrite.get("folderPath", ""),
|
|
@@ -86,7 +93,7 @@ class OverwritesManager:
|
|
|
86
93
|
|
|
87
94
|
def get_and_apply_overwrite(
|
|
88
95
|
self, resource_type: str, resource_name: str, folder_path: Optional[str] = None
|
|
89
|
-
) -> Tuple[
|
|
96
|
+
) -> Tuple[Any, Any]:
|
|
90
97
|
"""Get and apply overwrites for a resource, falling back to provided values if no overwrites exist.
|
|
91
98
|
|
|
92
99
|
Args:
|
|
@@ -98,14 +105,10 @@ class OverwritesManager:
|
|
|
98
105
|
A tuple of (name, folder_path) with overwritten values if available,
|
|
99
106
|
otherwise the original values.
|
|
100
107
|
"""
|
|
101
|
-
overwrite = self.get_overwrite(resource_type, resource_name)
|
|
108
|
+
overwrite = self.get_overwrite(resource_type, resource_name, folder_path)
|
|
102
109
|
if overwrite:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if folder_path is None:
|
|
106
|
-
folder_path = overwrite_folder_path
|
|
107
|
-
return name, folder_path
|
|
108
|
-
return resource_name, folder_path or ""
|
|
110
|
+
resource_name, folder_path = overwrite
|
|
111
|
+
return resource_name, folder_path or None
|
|
109
112
|
|
|
110
113
|
|
|
111
114
|
@contextmanager
|
uipath/_utils/constants.py
CHANGED
|
@@ -18,9 +18,6 @@ HEADER_USER_AGENT = "x-uipath-user-agent"
|
|
|
18
18
|
HEADER_TENANT_ID = "x-uipath-tenantid"
|
|
19
19
|
HEADER_JOB_KEY = "x-uipath-jobkey"
|
|
20
20
|
|
|
21
|
-
# Entrypoint for plugins
|
|
22
|
-
ENTRYPOINT = "uipath.connectors"
|
|
23
|
-
|
|
24
21
|
# Data sources
|
|
25
22
|
ORCHESTRATOR_STORAGE_BUCKET_DATA_SOURCE = (
|
|
26
23
|
"#UiPath.Vdbs.Domain.Api.V20Models.StorageBucketDataSourceRequest"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uipath
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.60
|
|
4
4
|
Summary: Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools.
|
|
5
5
|
Project-URL: Homepage, https://uipath.com
|
|
6
6
|
Project-URL: Repository, https://github.com/UiPath/uipath-python
|
|
@@ -8,7 +8,7 @@ uipath/_cli/README.md,sha256=GLtCfbeIKZKNnGTCsfSVqRQ27V1btT1i2bSAyW_xZl4,474
|
|
|
8
8
|
uipath/_cli/__init__.py,sha256=vGz3vJHkUvgK9_lKdzqiwwHkge1TCALRiOzGGwyr-8E,1885
|
|
9
9
|
uipath/_cli/cli_auth.py,sha256=aIecyySuGXJEQHnS6b-M6sxM7ki5trjqq_J7s-sCdQE,3966
|
|
10
10
|
uipath/_cli/cli_deploy.py,sha256=KPCmQ0c_NYD5JofSDao5r6QYxHshVCRxlWDVnQvlp5w,645
|
|
11
|
-
uipath/_cli/cli_init.py,sha256=
|
|
11
|
+
uipath/_cli/cli_init.py,sha256=JM-0E15sxOLd1o4X2NaiN2FPRuA7XV2lwtCVS0s-v7E,3866
|
|
12
12
|
uipath/_cli/cli_invoke.py,sha256=IjndcDWBpvAqGCRanQU1vfmxaBF8FhyZ7gWuZqwjHrU,3812
|
|
13
13
|
uipath/_cli/cli_new.py,sha256=9378NYUBc9j-qKVXV7oja-jahfJhXBg8zKVyaon7ctY,2102
|
|
14
14
|
uipath/_cli/cli_pack.py,sha256=8Ahk0vr_8eqMsq9ehhYWNfeII0VIiZVBXMpRF7Dbvtg,15018
|
|
@@ -35,34 +35,35 @@ uipath/_cli/_templates/main.py.template,sha256=QB62qX5HKDbW4lFskxj7h9uuxBITnTWqu
|
|
|
35
35
|
uipath/_cli/_templates/package.nuspec.template,sha256=YZyLc-u_EsmIoKf42JsLQ55OGeFmb8VkIU2VF7DFbtw,359
|
|
36
36
|
uipath/_cli/_utils/_common.py,sha256=h0-lvaAzz-4iM7WuEqZhlTo5QadBpsQyAdlggx73-PA,1123
|
|
37
37
|
uipath/_cli/_utils/_console.py,sha256=rj4V3yeR1wnJzFTHnaE6wcY9OoJV-PiIQnLg_p62ClQ,6664
|
|
38
|
+
uipath/_cli/_utils/_constants.py,sha256=mCeSWLURgw_dOMXjzyYBAvxKN3Vcd1vf7XKHgbdrOds,25
|
|
38
39
|
uipath/_cli/_utils/_folders.py,sha256=usjLNOMdhvelEv0wsJ-v6q-qiUR1tbwXJL4Sd_SOocI,970
|
|
39
40
|
uipath/_cli/_utils/_input_args.py,sha256=pyQhEcQXHdFHYTVNzvfWp439aii5StojoptnmCv5lfs,4094
|
|
40
|
-
uipath/_cli/_utils/_parse_ast.py,sha256=
|
|
41
|
+
uipath/_cli/_utils/_parse_ast.py,sha256=A-QToBIf-oP7yP2DQTHO6blkk6ik5z_IeaIwtEWO4e0,19516
|
|
41
42
|
uipath/_cli/_utils/_processes.py,sha256=iCGNf1y_K_r3bdmX9VWA70UP20bdUzKlMRrAxkdkdm4,1669
|
|
42
43
|
uipath/_services/__init__.py,sha256=10xtw3ENC30yR9CCq_b94RMZ3YrUeyfHV33yWYUd8tU,896
|
|
43
44
|
uipath/_services/_base_service.py,sha256=y-QATIRF9JnUFKIwmjOWMHlE2BrJYgD8y4sGAve2kEM,5338
|
|
44
45
|
uipath/_services/actions_service.py,sha256=LYKvG4VxNGQgZ46AzGK9kI1Txb-YmVvZj5ScPOue8Ls,15989
|
|
45
46
|
uipath/_services/api_client.py,sha256=hcof0EMa4-phEHD1WlO7Tdfzq6aL18Sbi2aBE7lJm1w,1821
|
|
46
|
-
uipath/_services/assets_service.py,sha256=
|
|
47
|
+
uipath/_services/assets_service.py,sha256=acqWogfhZiSO1eeVYqFxmqWGSTmrW46QxI1J0bJe3jo,11918
|
|
47
48
|
uipath/_services/attachments_service.py,sha256=h2pEm5YcW0x5F6Ti3CKB7ufg2FBE7MYhyc1mRmuKca4,26372
|
|
48
|
-
uipath/_services/buckets_service.py,sha256=
|
|
49
|
+
uipath/_services/buckets_service.py,sha256=Ikqt1Cgs_o2-2kuzcogcaBkNceSQDXLEe63kzkHzWqk,17374
|
|
49
50
|
uipath/_services/connections_service.py,sha256=qh-HNL_GJsyPUD0wSJZRF8ZdrTE9l4HrIilmXGK6dDk,4581
|
|
50
|
-
uipath/_services/context_grounding_service.py,sha256=
|
|
51
|
+
uipath/_services/context_grounding_service.py,sha256=zS991jW8C8CLkXvJwB2SuY3edTRG84SUOmiXpKId2Go,24381
|
|
51
52
|
uipath/_services/folder_service.py,sha256=h0CWNqF2-8w2QLrfy-D8P3z_qA81Te689OXlFKtnby0,2001
|
|
52
53
|
uipath/_services/jobs_service.py,sha256=I2-iqjMJcfgz5sgVOMWF5PkGzch_1q1swUstdv2PpMo,27308
|
|
53
54
|
uipath/_services/llm_gateway_service.py,sha256=ySg3sflIoXmY9K7txlSm7bkuI2qzBT0kAKmGlFBk5KA,12032
|
|
54
|
-
uipath/_services/processes_service.py,sha256=
|
|
55
|
+
uipath/_services/processes_service.py,sha256=b-c4ynjcgS0ymp130r0lI93z7DF989u8HWOmWCux754,5727
|
|
55
56
|
uipath/_services/queues_service.py,sha256=VaG3dWL2QK6AJBOLoW2NQTpkPfZjsqsYPl9-kfXPFzA,13534
|
|
56
57
|
uipath/_utils/__init__.py,sha256=VdcpnENJIa0R6Y26NoxY64-wUVyvb4pKfTh1wXDQeMk,526
|
|
57
58
|
uipath/_utils/_endpoint.py,sha256=yYHwqbQuJIevpaTkdfYJS9CrtlFeEyfb5JQK5osTCog,2489
|
|
58
|
-
uipath/_utils/_infer_bindings.py,sha256=
|
|
59
|
+
uipath/_utils/_infer_bindings.py,sha256=cgsXUedRkVoplR3xGIACGuUge_mBq6H90QiQ6zG9fhY,1686
|
|
59
60
|
uipath/_utils/_logs.py,sha256=adfX_0UAn3YBeKJ8DQDeZs94rJyHGQO00uDfkaTpNWQ,510
|
|
60
|
-
uipath/_utils/_read_overwrites.py,sha256=
|
|
61
|
+
uipath/_utils/_read_overwrites.py,sha256=OQgG9ycPpFnLub5ELQdX9V2Fyh6F9_zDR3xoYagJaMI,5287
|
|
61
62
|
uipath/_utils/_request_override.py,sha256=fIVHzgHVXITUlWcp8osNBwIafM1qm4_ejx0ng5UzfJ4,573
|
|
62
63
|
uipath/_utils/_request_spec.py,sha256=iCtBLqtbWUpFG5g1wtIZBzSupKsfaRLiQFoFc_4B70Q,747
|
|
63
64
|
uipath/_utils/_url.py,sha256=-4eluSrIZCUlnQ3qU17WPJkgaC2KwF9W5NeqGnTNGGo,2512
|
|
64
65
|
uipath/_utils/_user_agent.py,sha256=pVJkFYacGwaQBomfwWVAvBQgdBUo62e4n3-fLIajWUU,563
|
|
65
|
-
uipath/_utils/constants.py,sha256=
|
|
66
|
+
uipath/_utils/constants.py,sha256=yf4Xd0gmdisrIrsdy3zuiOgboK-XYAcrd4ekb3ZjZeE,878
|
|
66
67
|
uipath/models/__init__.py,sha256=Kwqv1LzWNfSxJLMQrInVen3KDJ1z0eCcr6szQa0G0VE,1251
|
|
67
68
|
uipath/models/action_schema.py,sha256=lKDhP7Eix23fFvfQrqqNmSOiPyyNF6tiRpUu0VZIn_M,714
|
|
68
69
|
uipath/models/actions.py,sha256=ekSH4YUQR4KPOH-heBm9yOgOfirndx0In4_S4VYWeEU,2993
|
|
@@ -86,8 +87,8 @@ uipath/tracing/__init__.py,sha256=GKRINyWdHVrDsI-8mrZDLdf0oey6GHGlNZTOADK-kgc,22
|
|
|
86
87
|
uipath/tracing/_otel_exporters.py,sha256=x0PDPmDKJcxashsuehVsSsqBCzRr6WsNFaq_3_HS5F0,3014
|
|
87
88
|
uipath/tracing/_traced.py,sha256=UL0TBqUexYb2PuUIY_am9l0TEeRGXFdxKEcDq5J-NXQ,16319
|
|
88
89
|
uipath/tracing/_utils.py,sha256=s0fQPlkrnd484_pcHuNvW6-ElHiZH8mkfMkYFBfwnCQ,10234
|
|
89
|
-
uipath-2.0.
|
|
90
|
-
uipath-2.0.
|
|
91
|
-
uipath-2.0.
|
|
92
|
-
uipath-2.0.
|
|
93
|
-
uipath-2.0.
|
|
90
|
+
uipath-2.0.60.dist-info/METADATA,sha256=W7Qu6GntJ4Lja7zIIMFPNmCX_lNAdMDlMrb-cVYWp8c,6304
|
|
91
|
+
uipath-2.0.60.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
92
|
+
uipath-2.0.60.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
|
|
93
|
+
uipath-2.0.60.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
|
94
|
+
uipath-2.0.60.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|