@uipath/uipath-typescript 1.0.0-beta.12 → 1.0.0-beta.13
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/dist/index.d.ts +3902 -15
- package/dist/index.esm.js +5278 -0
- package/dist/index.js +5343 -19
- package/package.json +11 -4
- package/dist/core/auth/service.d.ts +0 -72
- package/dist/core/auth/service.d.ts.map +0 -1
- package/dist/core/auth/service.js +0 -244
- package/dist/core/auth/service.js.map +0 -1
- package/dist/core/auth/token-manager.d.ts +0 -82
- package/dist/core/auth/token-manager.d.ts.map +0 -1
- package/dist/core/auth/token-manager.js +0 -248
- package/dist/core/auth/token-manager.js.map +0 -1
- package/dist/core/auth/types.d.ts +0 -20
- package/dist/core/auth/types.d.ts.map +0 -1
- package/dist/core/auth/types.js +0 -2
- package/dist/core/auth/types.js.map +0 -1
- package/dist/core/config/config-utils.d.ts +0 -4
- package/dist/core/config/config-utils.d.ts.map +0 -1
- package/dist/core/config/config-utils.js +0 -13
- package/dist/core/config/config-utils.js.map +0 -1
- package/dist/core/config/config.d.ts +0 -48
- package/dist/core/config/config.d.ts.map +0 -1
- package/dist/core/config/config.js +0 -22
- package/dist/core/config/config.js.map +0 -1
- package/dist/core/config/sdk-config.d.ts +0 -33
- package/dist/core/config/sdk-config.d.ts.map +0 -1
- package/dist/core/config/sdk-config.js +0 -9
- package/dist/core/config/sdk-config.js.map +0 -1
- package/dist/core/context/execution.d.ts +0 -35
- package/dist/core/context/execution.d.ts.map +0 -1
- package/dist/core/context/execution.js +0 -55
- package/dist/core/context/execution.js.map +0 -1
- package/dist/core/errors/authentication.d.ts +0 -13
- package/dist/core/errors/authentication.d.ts.map +0 -1
- package/dist/core/errors/authentication.js +0 -19
- package/dist/core/errors/authentication.js.map +0 -1
- package/dist/core/errors/authorization.d.ts +0 -13
- package/dist/core/errors/authorization.d.ts.map +0 -1
- package/dist/core/errors/authorization.js +0 -19
- package/dist/core/errors/authorization.js.map +0 -1
- package/dist/core/errors/base.d.ts +0 -41
- package/dist/core/errors/base.d.ts.map +0 -1
- package/dist/core/errors/base.js +0 -37
- package/dist/core/errors/base.js.map +0 -1
- package/dist/core/errors/constants.d.ts +0 -57
- package/dist/core/errors/constants.d.ts.map +0 -1
- package/dist/core/errors/constants.js +0 -66
- package/dist/core/errors/constants.js.map +0 -1
- package/dist/core/errors/error-factory.d.ts +0 -17
- package/dist/core/errors/error-factory.d.ts.map +0 -1
- package/dist/core/errors/error-factory.js +0 -57
- package/dist/core/errors/error-factory.js.map +0 -1
- package/dist/core/errors/guards.d.ts +0 -48
- package/dist/core/errors/guards.d.ts.map +0 -1
- package/dist/core/errors/guards.js +0 -76
- package/dist/core/errors/guards.js.map +0 -1
- package/dist/core/errors/index.d.ts +0 -11
- package/dist/core/errors/index.d.ts.map +0 -1
- package/dist/core/errors/index.js +0 -15
- package/dist/core/errors/index.js.map +0 -1
- package/dist/core/errors/network.d.ts +0 -14
- package/dist/core/errors/network.d.ts.map +0 -1
- package/dist/core/errors/network.js +0 -20
- package/dist/core/errors/network.js.map +0 -1
- package/dist/core/errors/not-found.d.ts +0 -13
- package/dist/core/errors/not-found.d.ts.map +0 -1
- package/dist/core/errors/not-found.js +0 -19
- package/dist/core/errors/not-found.js.map +0 -1
- package/dist/core/errors/parser.d.ts +0 -29
- package/dist/core/errors/parser.d.ts.map +0 -1
- package/dist/core/errors/parser.js +0 -152
- package/dist/core/errors/parser.js.map +0 -1
- package/dist/core/errors/rate-limit.d.ts +0 -12
- package/dist/core/errors/rate-limit.d.ts.map +0 -1
- package/dist/core/errors/rate-limit.js +0 -18
- package/dist/core/errors/rate-limit.js.map +0 -1
- package/dist/core/errors/server.d.ts +0 -17
- package/dist/core/errors/server.d.ts.map +0 -1
- package/dist/core/errors/server.js +0 -27
- package/dist/core/errors/server.js.map +0 -1
- package/dist/core/errors/types.d.ts +0 -94
- package/dist/core/errors/types.d.ts.map +0 -1
- package/dist/core/errors/types.js +0 -28
- package/dist/core/errors/types.js.map +0 -1
- package/dist/core/errors/validation.d.ts +0 -13
- package/dist/core/errors/validation.d.ts.map +0 -1
- package/dist/core/errors/validation.js +0 -19
- package/dist/core/errors/validation.js.map +0 -1
- package/dist/core/http/api-client.d.ts +0 -30
- package/dist/core/http/api-client.d.ts.map +0 -1
- package/dist/core/http/api-client.js +0 -131
- package/dist/core/http/api-client.js.map +0 -1
- package/dist/core/telemetry/client.d.ts +0 -34
- package/dist/core/telemetry/client.d.ts.map +0 -1
- package/dist/core/telemetry/client.js +0 -193
- package/dist/core/telemetry/client.js.map +0 -1
- package/dist/core/telemetry/constants.d.ts +0 -19
- package/dist/core/telemetry/constants.d.ts.map +0 -1
- package/dist/core/telemetry/constants.js +0 -24
- package/dist/core/telemetry/constants.js.map +0 -1
- package/dist/core/telemetry/index.d.ts +0 -7
- package/dist/core/telemetry/index.d.ts.map +0 -1
- package/dist/core/telemetry/index.js +0 -7
- package/dist/core/telemetry/index.js.map +0 -1
- package/dist/core/telemetry/track.d.ts +0 -26
- package/dist/core/telemetry/track.d.ts.map +0 -1
- package/dist/core/telemetry/track.js +0 -67
- package/dist/core/telemetry/track.js.map +0 -1
- package/dist/core/telemetry/types.d.ts +0 -18
- package/dist/core/telemetry/types.d.ts.map +0 -1
- package/dist/core/telemetry/types.js +0 -5
- package/dist/core/telemetry/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/models/action-center/index.d.ts +0 -3
- package/dist/models/action-center/index.d.ts.map +0 -1
- package/dist/models/action-center/index.js +0 -3
- package/dist/models/action-center/index.js.map +0 -1
- package/dist/models/action-center/tasks.constants.d.ts +0 -12
- package/dist/models/action-center/tasks.constants.d.ts.map +0 -1
- package/dist/models/action-center/tasks.constants.js +0 -18
- package/dist/models/action-center/tasks.constants.js.map +0 -1
- package/dist/models/action-center/tasks.internal-types.d.ts +0 -13
- package/dist/models/action-center/tasks.internal-types.d.ts.map +0 -1
- package/dist/models/action-center/tasks.internal-types.js +0 -2
- package/dist/models/action-center/tasks.internal-types.js.map +0 -1
- package/dist/models/action-center/tasks.models.d.ts +0 -79
- package/dist/models/action-center/tasks.models.d.ts.map +0 -1
- package/dist/models/action-center/tasks.models.js +0 -60
- package/dist/models/action-center/tasks.models.js.map +0 -1
- package/dist/models/action-center/tasks.types.d.ts +0 -180
- package/dist/models/action-center/tasks.types.d.ts.map +0 -1
- package/dist/models/action-center/tasks.types.js +0 -40
- package/dist/models/action-center/tasks.types.js.map +0 -1
- package/dist/models/common/index.d.ts +0 -3
- package/dist/models/common/index.d.ts.map +0 -1
- package/dist/models/common/index.js +0 -3
- package/dist/models/common/index.js.map +0 -1
- package/dist/models/common/request-spec.d.ts +0 -89
- package/dist/models/common/request-spec.d.ts.map +0 -1
- package/dist/models/common/request-spec.js +0 -2
- package/dist/models/common/request-spec.js.map +0 -1
- package/dist/models/common/types.d.ts +0 -43
- package/dist/models/common/types.d.ts.map +0 -1
- package/dist/models/common/types.js +0 -16
- package/dist/models/common/types.js.map +0 -1
- package/dist/models/data-fabric/entities.constants.d.ts +0 -32
- package/dist/models/data-fabric/entities.constants.d.ts.map +0 -1
- package/dist/models/data-fabric/entities.constants.js +0 -46
- package/dist/models/data-fabric/entities.constants.js.map +0 -1
- package/dist/models/data-fabric/entities.internal-types.d.ts +0 -12
- package/dist/models/data-fabric/entities.internal-types.d.ts.map +0 -1
- package/dist/models/data-fabric/entities.internal-types.js +0 -2
- package/dist/models/data-fabric/entities.internal-types.js.map +0 -1
- package/dist/models/data-fabric/entities.models.d.ts +0 -213
- package/dist/models/data-fabric/entities.models.d.ts.map +0 -1
- package/dist/models/data-fabric/entities.models.js +0 -43
- package/dist/models/data-fabric/entities.models.js.map +0 -1
- package/dist/models/data-fabric/entities.types.d.ts +0 -264
- package/dist/models/data-fabric/entities.types.d.ts.map +0 -1
- package/dist/models/data-fabric/entities.types.js +0 -63
- package/dist/models/data-fabric/entities.types.js.map +0 -1
- package/dist/models/data-fabric/index.d.ts +0 -3
- package/dist/models/data-fabric/index.d.ts.map +0 -1
- package/dist/models/data-fabric/index.js +0 -3
- package/dist/models/data-fabric/index.js.map +0 -1
- package/dist/models/index.d.ts +0 -6
- package/dist/models/index.d.ts.map +0 -1
- package/dist/models/index.js +0 -11
- package/dist/models/index.js.map +0 -1
- package/dist/models/maestro/index.d.ts +0 -5
- package/dist/models/maestro/index.d.ts.map +0 -1
- package/dist/models/maestro/index.js +0 -8
- package/dist/models/maestro/index.js.map +0 -1
- package/dist/models/maestro/process-instances.constants.d.ts +0 -13
- package/dist/models/maestro/process-instances.constants.d.ts.map +0 -1
- package/dist/models/maestro/process-instances.constants.js +0 -17
- package/dist/models/maestro/process-instances.constants.js.map +0 -1
- package/dist/models/maestro/process-instances.models.d.ts +0 -210
- package/dist/models/maestro/process-instances.models.d.ts.map +0 -1
- package/dist/models/maestro/process-instances.models.js +0 -38
- package/dist/models/maestro/process-instances.models.js.map +0 -1
- package/dist/models/maestro/process-instances.types.d.ts +0 -78
- package/dist/models/maestro/process-instances.types.d.ts.map +0 -1
- package/dist/models/maestro/process-instances.types.js +0 -6
- package/dist/models/maestro/process-instances.types.js.map +0 -1
- package/dist/models/maestro/processes.models.d.ts +0 -31
- package/dist/models/maestro/processes.models.d.ts.map +0 -1
- package/dist/models/maestro/processes.models.js +0 -6
- package/dist/models/maestro/processes.models.js.map +0 -1
- package/dist/models/maestro/processes.types.d.ts +0 -42
- package/dist/models/maestro/processes.types.d.ts.map +0 -1
- package/dist/models/maestro/processes.types.js +0 -6
- package/dist/models/maestro/processes.types.js.map +0 -1
- package/dist/models/orchestrator/assets.constants.d.ts +0 -7
- package/dist/models/orchestrator/assets.constants.d.ts.map +0 -1
- package/dist/models/orchestrator/assets.constants.js +0 -8
- package/dist/models/orchestrator/assets.constants.js.map +0 -1
- package/dist/models/orchestrator/assets.models.d.ts +0 -55
- package/dist/models/orchestrator/assets.models.d.ts.map +0 -1
- package/dist/models/orchestrator/assets.models.js +0 -2
- package/dist/models/orchestrator/assets.models.js.map +0 -1
- package/dist/models/orchestrator/assets.types.d.ts +0 -65
- package/dist/models/orchestrator/assets.types.d.ts.map +0 -1
- package/dist/models/orchestrator/assets.types.js +0 -24
- package/dist/models/orchestrator/assets.types.js.map +0 -1
- package/dist/models/orchestrator/buckets.constants.d.ts +0 -7
- package/dist/models/orchestrator/buckets.constants.d.ts.map +0 -1
- package/dist/models/orchestrator/buckets.constants.js +0 -9
- package/dist/models/orchestrator/buckets.constants.js.map +0 -1
- package/dist/models/orchestrator/buckets.models.d.ts +0 -144
- package/dist/models/orchestrator/buckets.models.d.ts.map +0 -1
- package/dist/models/orchestrator/buckets.models.js +0 -2
- package/dist/models/orchestrator/buckets.models.js.map +0 -1
- package/dist/models/orchestrator/buckets.types.d.ts +0 -176
- package/dist/models/orchestrator/buckets.types.d.ts.map +0 -1
- package/dist/models/orchestrator/buckets.types.js +0 -8
- package/dist/models/orchestrator/buckets.types.js.map +0 -1
- package/dist/models/orchestrator/index.d.ts +0 -9
- package/dist/models/orchestrator/index.d.ts.map +0 -1
- package/dist/models/orchestrator/index.js +0 -13
- package/dist/models/orchestrator/index.js.map +0 -1
- package/dist/models/orchestrator/processes.constants.d.ts +0 -7
- package/dist/models/orchestrator/processes.constants.d.ts.map +0 -1
- package/dist/models/orchestrator/processes.constants.js +0 -17
- package/dist/models/orchestrator/processes.constants.js.map +0 -1
- package/dist/models/orchestrator/processes.models.d.ts +0 -87
- package/dist/models/orchestrator/processes.models.d.ts.map +0 -1
- package/dist/models/orchestrator/processes.models.js +0 -2
- package/dist/models/orchestrator/processes.models.js.map +0 -1
- package/dist/models/orchestrator/processes.types.d.ts +0 -293
- package/dist/models/orchestrator/processes.types.d.ts.map +0 -1
- package/dist/models/orchestrator/processes.types.js +0 -110
- package/dist/models/orchestrator/processes.types.js.map +0 -1
- package/dist/models/orchestrator/queues.constants.d.ts +0 -7
- package/dist/models/orchestrator/queues.constants.d.ts.map +0 -1
- package/dist/models/orchestrator/queues.constants.js +0 -9
- package/dist/models/orchestrator/queues.constants.js.map +0 -1
- package/dist/models/orchestrator/queues.models.d.ts +0 -61
- package/dist/models/orchestrator/queues.models.d.ts.map +0 -1
- package/dist/models/orchestrator/queues.models.js +0 -2
- package/dist/models/orchestrator/queues.models.js.map +0 -1
- package/dist/models/orchestrator/queues.types.d.ts +0 -39
- package/dist/models/orchestrator/queues.types.d.ts.map +0 -1
- package/dist/models/orchestrator/queues.types.js +0 -2
- package/dist/models/orchestrator/queues.types.js.map +0 -1
- package/dist/services/action-center/index.d.ts +0 -2
- package/dist/services/action-center/index.d.ts.map +0 -1
- package/dist/services/action-center/index.js +0 -2
- package/dist/services/action-center/index.js.map +0 -1
- package/dist/services/action-center/tasks.d.ts +0 -254
- package/dist/services/action-center/tasks.d.ts.map +0 -1
- package/dist/services/action-center/tasks.js +0 -446
- package/dist/services/action-center/tasks.js.map +0 -1
- package/dist/services/base.d.ts +0 -49
- package/dist/services/base.d.ts.map +0 -1
- package/dist/services/base.js +0 -183
- package/dist/services/base.js.map +0 -1
- package/dist/services/data-fabric/entities.d.ts +0 -180
- package/dist/services/data-fabric/entities.d.ts.map +0 -1
- package/dist/services/data-fabric/entities.js +0 -326
- package/dist/services/data-fabric/entities.js.map +0 -1
- package/dist/services/data-fabric/index.d.ts +0 -2
- package/dist/services/data-fabric/index.d.ts.map +0 -1
- package/dist/services/data-fabric/index.js +0 -2
- package/dist/services/data-fabric/index.js.map +0 -1
- package/dist/services/folder-scoped.d.ts +0 -21
- package/dist/services/folder-scoped.d.ts.map +0 -1
- package/dist/services/folder-scoped.js +0 -36
- package/dist/services/folder-scoped.js.map +0 -1
- package/dist/services/index.d.ts +0 -6
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/index.js +0 -6
- package/dist/services/index.js.map +0 -1
- package/dist/services/maestro/index.d.ts +0 -3
- package/dist/services/maestro/index.d.ts.map +0 -1
- package/dist/services/maestro/index.js +0 -3
- package/dist/services/maestro/index.js.map +0 -1
- package/dist/services/maestro/maestro-processes.d.ts +0 -35
- package/dist/services/maestro/maestro-processes.d.ts.map +0 -1
- package/dist/services/maestro/maestro-processes.js +0 -47
- package/dist/services/maestro/maestro-processes.js.map +0 -1
- package/dist/services/maestro/process-instances.d.ts +0 -96
- package/dist/services/maestro/process-instances.d.ts.map +0 -1
- package/dist/services/maestro/process-instances.js +0 -190
- package/dist/services/maestro/process-instances.js.map +0 -1
- package/dist/services/orchestrator/assets.d.ts +0 -63
- package/dist/services/orchestrator/assets.d.ts.map +0 -1
- package/dist/services/orchestrator/assets.js +0 -110
- package/dist/services/orchestrator/assets.js.map +0 -1
- package/dist/services/orchestrator/buckets.d.ts +0 -186
- package/dist/services/orchestrator/buckets.d.ts.map +0 -1
- package/dist/services/orchestrator/buckets.js +0 -436
- package/dist/services/orchestrator/buckets.js.map +0 -1
- package/dist/services/orchestrator/index.d.ts +0 -5
- package/dist/services/orchestrator/index.d.ts.map +0 -1
- package/dist/services/orchestrator/index.js +0 -5
- package/dist/services/orchestrator/index.js.map +0 -1
- package/dist/services/orchestrator/processes.d.ts +0 -96
- package/dist/services/orchestrator/processes.d.ts.map +0 -1
- package/dist/services/orchestrator/processes.js +0 -172
- package/dist/services/orchestrator/processes.js.map +0 -1
- package/dist/services/orchestrator/queues.d.ts +0 -72
- package/dist/services/orchestrator/queues.d.ts.map +0 -1
- package/dist/services/orchestrator/queues.js +0 -117
- package/dist/services/orchestrator/queues.js.map +0 -1
- package/dist/uipath.d.ts +0 -65
- package/dist/uipath.d.ts.map +0 -1
- package/dist/uipath.js +0 -146
- package/dist/uipath.js.map +0 -1
- package/dist/utils/constants/common.d.ts +0 -84
- package/dist/utils/constants/common.d.ts.map +0 -1
- package/dist/utils/constants/common.js +0 -84
- package/dist/utils/constants/common.js.map +0 -1
- package/dist/utils/constants/endpoints.d.ts +0 -96
- package/dist/utils/constants/endpoints.d.ts.map +0 -1
- package/dist/utils/constants/endpoints.js +0 -96
- package/dist/utils/constants/endpoints.js.map +0 -1
- package/dist/utils/constants/headers.d.ts +0 -27
- package/dist/utils/constants/headers.d.ts.map +0 -1
- package/dist/utils/constants/headers.js +0 -27
- package/dist/utils/constants/headers.js.map +0 -1
- package/dist/utils/encoding/base64.d.ts +0 -13
- package/dist/utils/encoding/base64.d.ts.map +0 -1
- package/dist/utils/encoding/base64.js +0 -49
- package/dist/utils/encoding/base64.js.map +0 -1
- package/dist/utils/encoding/index.d.ts +0 -2
- package/dist/utils/encoding/index.d.ts.map +0 -1
- package/dist/utils/encoding/index.js +0 -2
- package/dist/utils/encoding/index.js.map +0 -1
- package/dist/utils/http/headers.d.ts +0 -37
- package/dist/utils/http/headers.d.ts.map +0 -1
- package/dist/utils/http/headers.js +0 -51
- package/dist/utils/http/headers.js.map +0 -1
- package/dist/utils/http/params.d.ts +0 -27
- package/dist/utils/http/params.d.ts.map +0 -1
- package/dist/utils/http/params.js +0 -35
- package/dist/utils/http/params.js.map +0 -1
- package/dist/utils/object.d.ts +0 -32
- package/dist/utils/object.d.ts.map +0 -1
- package/dist/utils/object.js +0 -50
- package/dist/utils/object.js.map +0 -1
- package/dist/utils/pagination/constants.d.ts +0 -18
- package/dist/utils/pagination/constants.d.ts.map +0 -1
- package/dist/utils/pagination/constants.js +0 -23
- package/dist/utils/pagination/constants.js.map +0 -1
- package/dist/utils/pagination/helpers.d.ts +0 -62
- package/dist/utils/pagination/helpers.d.ts.map +0 -1
- package/dist/utils/pagination/helpers.js +0 -255
- package/dist/utils/pagination/helpers.js.map +0 -1
- package/dist/utils/pagination/index.d.ts +0 -3
- package/dist/utils/pagination/index.d.ts.map +0 -1
- package/dist/utils/pagination/index.js +0 -3
- package/dist/utils/pagination/index.js.map +0 -1
- package/dist/utils/pagination/internal-types.d.ts +0 -184
- package/dist/utils/pagination/internal-types.d.ts.map +0 -1
- package/dist/utils/pagination/internal-types.js +0 -9
- package/dist/utils/pagination/internal-types.js.map +0 -1
- package/dist/utils/pagination/pagination-manager.d.ts +0 -17
- package/dist/utils/pagination/pagination-manager.d.ts.map +0 -1
- package/dist/utils/pagination/pagination-manager.js +0 -77
- package/dist/utils/pagination/pagination-manager.js.map +0 -1
- package/dist/utils/pagination/types.d.ts +0 -68
- package/dist/utils/pagination/types.d.ts.map +0 -1
- package/dist/utils/pagination/types.js +0 -2
- package/dist/utils/pagination/types.js.map +0 -1
- package/dist/utils/platform.d.ts +0 -8
- package/dist/utils/platform.d.ts.map +0 -1
- package/dist/utils/platform.js +0 -8
- package/dist/utils/platform.js.map +0 -1
- package/dist/utils/transform.d.ts +0 -240
- package/dist/utils/transform.d.ts.map +0 -1
- package/dist/utils/transform.js +0 -334
- package/dist/utils/transform.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,3903 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
4
|
+
baseUrl: z.ZodDefault<z.ZodString>;
|
|
5
|
+
orgName: z.ZodString;
|
|
6
|
+
tenantName: z.ZodString;
|
|
7
|
+
secret: z.ZodOptional<z.ZodString>;
|
|
8
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
redirectUri: z.ZodOptional<z.ZodString>;
|
|
10
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
orgName: string;
|
|
14
|
+
tenantName: string;
|
|
15
|
+
secret?: string | undefined;
|
|
16
|
+
clientId?: string | undefined;
|
|
17
|
+
redirectUri?: string | undefined;
|
|
18
|
+
scope?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
orgName: string;
|
|
21
|
+
tenantName: string;
|
|
22
|
+
baseUrl?: string | undefined;
|
|
23
|
+
secret?: string | undefined;
|
|
24
|
+
clientId?: string | undefined;
|
|
25
|
+
redirectUri?: string | undefined;
|
|
26
|
+
scope?: string | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
type Config = z.infer<typeof ConfigSchema>;
|
|
29
|
+
|
|
1
30
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
31
|
+
* Simplified universal pagination cursor
|
|
32
|
+
* Used to fetch next/previous pages
|
|
33
|
+
*/
|
|
34
|
+
interface PaginationCursor {
|
|
35
|
+
/** Opaque string containing all information needed to fetch next page */
|
|
36
|
+
value: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Discriminated union for pagination methods - ensures cursor and jumpToPage are mutually exclusive
|
|
40
|
+
*/
|
|
41
|
+
type PaginationMethodUnion = {
|
|
42
|
+
cursor?: PaginationCursor;
|
|
43
|
+
jumpToPage?: never;
|
|
44
|
+
} | {
|
|
45
|
+
cursor?: never;
|
|
46
|
+
jumpToPage?: number;
|
|
47
|
+
} | {
|
|
48
|
+
cursor?: never;
|
|
49
|
+
jumpToPage?: never;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Pagination options. Users cannot specify both cursor and jumpToPage.
|
|
53
|
+
*/
|
|
54
|
+
type PaginationOptions = {
|
|
55
|
+
/** Size of the page to fetch (items per page) */
|
|
56
|
+
pageSize?: number;
|
|
57
|
+
} & PaginationMethodUnion;
|
|
58
|
+
/**
|
|
59
|
+
* Paginated response containing items and navigation information
|
|
60
|
+
*/
|
|
61
|
+
interface PaginatedResponse<T> {
|
|
62
|
+
/** The items in the current page */
|
|
63
|
+
items: T[];
|
|
64
|
+
/** Total count of items across all pages (if available) */
|
|
65
|
+
totalCount?: number;
|
|
66
|
+
/** Whether more pages are available */
|
|
67
|
+
hasNextPage: boolean;
|
|
68
|
+
/** Cursor to fetch the next page (if available) */
|
|
69
|
+
nextCursor?: PaginationCursor;
|
|
70
|
+
/** Cursor to fetch the previous page (if available) */
|
|
71
|
+
previousCursor?: PaginationCursor;
|
|
72
|
+
/** Current page number (1-based, if available) */
|
|
73
|
+
currentPage?: number;
|
|
74
|
+
/** Total number of pages (if available) */
|
|
75
|
+
totalPages?: number;
|
|
76
|
+
/** Whether this pagination type supports jumping to arbitrary pages */
|
|
77
|
+
supportsPageJump: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Response for non-paginated calls that includes both data and total count
|
|
81
|
+
*/
|
|
82
|
+
interface NonPaginatedResponse<T> {
|
|
83
|
+
items: T[];
|
|
84
|
+
totalCount?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Helper type for defining paginated method overloads
|
|
88
|
+
* Creates a union type of all ways pagination can be triggered
|
|
89
|
+
*/
|
|
90
|
+
type HasPaginationOptions<T> = (T & {
|
|
91
|
+
pageSize: number;
|
|
92
|
+
}) | (T & {
|
|
93
|
+
cursor: PaginationCursor;
|
|
94
|
+
}) | (T & {
|
|
95
|
+
jumpToPage: number;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Pagination types supported by the SDK
|
|
100
|
+
*/
|
|
101
|
+
declare enum PaginationType {
|
|
102
|
+
OFFSET = "offset",
|
|
103
|
+
TOKEN = "token"
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Interface for service access methods needed by pagination helpers
|
|
107
|
+
*/
|
|
108
|
+
interface PaginationServiceAccess {
|
|
109
|
+
get<T>(path: string, options?: any): Promise<{
|
|
110
|
+
data: T;
|
|
111
|
+
}>;
|
|
112
|
+
requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Field names for extracting data from paginated responses.
|
|
116
|
+
*/
|
|
117
|
+
interface PaginationFieldNames {
|
|
118
|
+
itemsField?: string;
|
|
119
|
+
totalCountField?: string;
|
|
120
|
+
continuationTokenField?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Options for the requestWithPagination method in BaseService.
|
|
124
|
+
*/
|
|
125
|
+
interface RequestWithPaginationOptions extends RequestSpec {
|
|
126
|
+
pagination: PaginationFieldNames & {
|
|
127
|
+
paginationType: PaginationType;
|
|
128
|
+
paginationParams?: {
|
|
129
|
+
pageSizeParam?: string;
|
|
130
|
+
offsetParam?: string;
|
|
131
|
+
tokenParam?: string;
|
|
132
|
+
countParam?: string;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* HTTP methods supported by the API client
|
|
139
|
+
*/
|
|
140
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
141
|
+
/**
|
|
142
|
+
* Supported response types for API requests
|
|
143
|
+
*/
|
|
144
|
+
type ResponseType = 'json' | 'text' | 'blob' | 'arraybuffer' | 'stream';
|
|
145
|
+
/**
|
|
146
|
+
* Query parameters type with support for arrays and nested objects
|
|
147
|
+
*/
|
|
148
|
+
type QueryParams = Record<string, string | number | boolean | Array<string | number | boolean> | null | undefined>;
|
|
149
|
+
/**
|
|
150
|
+
* Standard HTTP headers type
|
|
151
|
+
*/
|
|
152
|
+
type Headers = Record<string, string>;
|
|
153
|
+
/**
|
|
154
|
+
* Options for request retries
|
|
155
|
+
*/
|
|
156
|
+
interface RetryOptions {
|
|
157
|
+
/** Maximum number of retry attempts */
|
|
158
|
+
maxRetries?: number;
|
|
159
|
+
/** Base delay between retries in milliseconds */
|
|
160
|
+
retryDelay?: number;
|
|
161
|
+
/** Whether to use exponential backoff */
|
|
162
|
+
useExponentialBackoff?: boolean;
|
|
163
|
+
/** Status codes that should trigger a retry */
|
|
164
|
+
retryableStatusCodes?: number[];
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Options for request timeouts
|
|
168
|
+
*/
|
|
169
|
+
interface TimeoutOptions {
|
|
170
|
+
/** Request timeout in milliseconds */
|
|
171
|
+
timeout?: number;
|
|
172
|
+
/** Whether to abort the request on timeout */
|
|
173
|
+
abortOnTimeout?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Options for request body transformation
|
|
177
|
+
*/
|
|
178
|
+
interface BodyOptions {
|
|
179
|
+
/** Whether to stringify the body */
|
|
180
|
+
stringify?: boolean;
|
|
181
|
+
/** Content type override */
|
|
182
|
+
contentType?: string;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Pagination metadata for API requests
|
|
186
|
+
*/
|
|
187
|
+
interface PaginationMetadata {
|
|
188
|
+
/** Type of pagination used by the API endpoint */
|
|
189
|
+
paginationType: PaginationType;
|
|
190
|
+
/** Response field containing items array (defaults to 'value') */
|
|
191
|
+
itemsField?: string;
|
|
192
|
+
/** Response field containing total count (defaults to '@odata.count') */
|
|
193
|
+
totalCountField?: string;
|
|
194
|
+
/** Response field containing continuation token (defaults to 'continuationToken') */
|
|
195
|
+
continuationTokenField?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Base interface for all API requests
|
|
199
|
+
*/
|
|
200
|
+
interface RequestSpec {
|
|
201
|
+
/** HTTP method for the request */
|
|
202
|
+
method?: HttpMethod;
|
|
203
|
+
/** URL endpoint for the request */
|
|
204
|
+
url?: string;
|
|
205
|
+
/** Query parameters to be appended to the URL */
|
|
206
|
+
params?: QueryParams;
|
|
207
|
+
/** HTTP headers to include with the request */
|
|
208
|
+
headers?: Headers;
|
|
209
|
+
/** Raw body content (takes precedence over data) */
|
|
210
|
+
body?: unknown;
|
|
211
|
+
/** Expected response type */
|
|
212
|
+
responseType?: ResponseType;
|
|
213
|
+
/** Request timeout options */
|
|
214
|
+
timeoutOptions?: TimeoutOptions;
|
|
215
|
+
/** Retry behavior options */
|
|
216
|
+
retryOptions?: RetryOptions;
|
|
217
|
+
/** Body transformation options */
|
|
218
|
+
bodyOptions?: BodyOptions;
|
|
219
|
+
/** AbortSignal for cancelling the request */
|
|
220
|
+
signal?: AbortSignal;
|
|
221
|
+
/** Pagination metadata for the request */
|
|
222
|
+
pagination?: PaginationMetadata;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* ExecutionContext manages the state and context of API operations.
|
|
227
|
+
* It provides a way to share context across service calls and maintain
|
|
228
|
+
* execution state throughout the lifecycle of operations.
|
|
229
|
+
*/
|
|
230
|
+
declare class ExecutionContext {
|
|
231
|
+
private context;
|
|
232
|
+
private headers;
|
|
233
|
+
/**
|
|
234
|
+
* Set a context value that will be available throughout the execution
|
|
235
|
+
*/
|
|
236
|
+
set<T>(key: string, value: T): void;
|
|
237
|
+
/**
|
|
238
|
+
* Get a previously set context value
|
|
239
|
+
*/
|
|
240
|
+
get<T>(key: string): T | undefined;
|
|
241
|
+
/**
|
|
242
|
+
* Set custom headers that will be included in all API requests
|
|
243
|
+
*/
|
|
244
|
+
setHeaders(headers: Record<string, string>): void;
|
|
245
|
+
/**
|
|
246
|
+
* Get all custom headers
|
|
247
|
+
*/
|
|
248
|
+
getHeaders(): Record<string, string>;
|
|
249
|
+
/**
|
|
250
|
+
* Clear all context and headers
|
|
251
|
+
*/
|
|
252
|
+
clear(): void;
|
|
253
|
+
/**
|
|
254
|
+
* Create a request spec for an API call
|
|
255
|
+
*/
|
|
256
|
+
createRequestSpec(spec?: Partial<RequestSpec>): RequestSpec;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Authentication token information
|
|
261
|
+
*/
|
|
262
|
+
interface TokenInfo {
|
|
263
|
+
token: string;
|
|
264
|
+
type: 'secret' | 'oauth';
|
|
265
|
+
expiresAt?: Date;
|
|
266
|
+
refreshToken?: string;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* OAuth token response
|
|
270
|
+
*/
|
|
271
|
+
interface AuthToken {
|
|
272
|
+
access_token: string;
|
|
273
|
+
token_type: string;
|
|
274
|
+
expires_in: number;
|
|
275
|
+
scope: string;
|
|
276
|
+
refresh_token?: string;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* TokenManager is responsible for managing authentication tokens.
|
|
281
|
+
* It provides token operations for a specific client ID.
|
|
282
|
+
* - For OAuth tokens: Uses session storage with client ID-based keys
|
|
283
|
+
* - For Secret tokens: Stores only in memory, allowing multiple instances
|
|
284
|
+
*/
|
|
285
|
+
declare class TokenManager {
|
|
286
|
+
private executionContext;
|
|
287
|
+
private config;
|
|
288
|
+
private isOAuth;
|
|
289
|
+
private currentToken?;
|
|
290
|
+
private readonly STORAGE_KEY_PREFIX;
|
|
291
|
+
private refreshPromise;
|
|
292
|
+
/**
|
|
293
|
+
* Creates a new TokenManager instance
|
|
294
|
+
* @param executionContext The execution context
|
|
295
|
+
* @param config The SDK configuration
|
|
296
|
+
* @param isOAuth Whether this is an OAuth-based authentication
|
|
297
|
+
*/
|
|
298
|
+
constructor(executionContext: ExecutionContext, config: Config, isOAuth?: boolean);
|
|
299
|
+
/**
|
|
300
|
+
* Checks if a token is expired
|
|
301
|
+
* @param tokenInfo The token info to check
|
|
302
|
+
* @returns true if the token is expired, false otherwise
|
|
303
|
+
*/
|
|
304
|
+
isTokenExpired(tokenInfo?: TokenInfo): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Gets the storage key for this TokenManager instance
|
|
307
|
+
*/
|
|
308
|
+
private _getStorageKey;
|
|
309
|
+
/**
|
|
310
|
+
* Loads token from session storage if available
|
|
311
|
+
* @returns true if a valid token was loaded, false otherwise
|
|
312
|
+
*/
|
|
313
|
+
loadFromStorage(): boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Parse and validate token info from storage
|
|
316
|
+
* @param storedToken JSON string from storage
|
|
317
|
+
* @returns Valid TokenInfo or undefined if invalid
|
|
318
|
+
*/
|
|
319
|
+
private _parseTokenInfo;
|
|
320
|
+
/**
|
|
321
|
+
* Sets a new token and updates all necessary contexts
|
|
322
|
+
*/
|
|
323
|
+
setToken(tokenInfo: TokenInfo): void;
|
|
324
|
+
/**
|
|
325
|
+
* Gets the current token information
|
|
326
|
+
*/
|
|
327
|
+
getTokenInfo(): TokenInfo | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* Gets just the token string
|
|
330
|
+
*/
|
|
331
|
+
getToken(): string | undefined;
|
|
332
|
+
/**
|
|
333
|
+
* Checks if we have a valid token
|
|
334
|
+
*/
|
|
335
|
+
hasValidToken(): boolean;
|
|
336
|
+
/**
|
|
337
|
+
* Clears the current token
|
|
338
|
+
*/
|
|
339
|
+
clearToken(): void;
|
|
340
|
+
/**
|
|
341
|
+
* Updates execution context with token information
|
|
342
|
+
*/
|
|
343
|
+
private _updateExecutionContext;
|
|
344
|
+
/**
|
|
345
|
+
* Refreshes the access token using the stored refresh token.
|
|
346
|
+
* This method only works for OAuth flow.
|
|
347
|
+
* Uses a lock mechanism to prevent multiple simultaneous refreshes.
|
|
348
|
+
* @returns A promise that resolves to the new AuthToken
|
|
349
|
+
* @throws Error if not in OAuth flow, refresh token is missing, or the request fails
|
|
350
|
+
*/
|
|
351
|
+
refreshAccessToken(): Promise<AuthToken>;
|
|
352
|
+
/**
|
|
353
|
+
* Internal method to perform the actual token refresh
|
|
354
|
+
*/
|
|
355
|
+
private _doRefreshToken;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
interface ApiClientConfig {
|
|
359
|
+
headers?: Record<string, string>;
|
|
360
|
+
}
|
|
361
|
+
declare class ApiClient {
|
|
362
|
+
private readonly config;
|
|
363
|
+
private readonly executionContext;
|
|
364
|
+
private readonly clientConfig;
|
|
365
|
+
private defaultHeaders;
|
|
366
|
+
private tokenManager;
|
|
367
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager, clientConfig?: ApiClientConfig);
|
|
368
|
+
setDefaultHeaders(headers: Record<string, string>): void;
|
|
369
|
+
/**
|
|
370
|
+
* Checks if the current token needs refresh and refreshes it if necessary
|
|
371
|
+
* @returns The valid token
|
|
372
|
+
* @throws Error if token refresh fails
|
|
373
|
+
*/
|
|
374
|
+
private ensureValidToken;
|
|
375
|
+
private getDefaultHeaders;
|
|
376
|
+
private request;
|
|
377
|
+
get<T>(path: string, options?: RequestSpec): Promise<T>;
|
|
378
|
+
post<T>(path: string, data?: unknown, options?: RequestSpec): Promise<T>;
|
|
379
|
+
put<T>(path: string, data?: unknown, options?: RequestSpec): Promise<T>;
|
|
380
|
+
patch<T>(path: string, data?: unknown, options?: RequestSpec): Promise<T>;
|
|
381
|
+
delete<T>(path: string, options?: RequestSpec): Promise<T>;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
interface ApiResponse<T> {
|
|
385
|
+
data: T;
|
|
386
|
+
}
|
|
387
|
+
declare class BaseService {
|
|
388
|
+
protected readonly config: Config;
|
|
389
|
+
protected readonly executionContext: ExecutionContext;
|
|
390
|
+
protected readonly apiClient: ApiClient;
|
|
391
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager);
|
|
392
|
+
/**
|
|
393
|
+
* Creates a service accessor for pagination helpers
|
|
394
|
+
* This allows pagination helpers to access protected methods without making them public
|
|
395
|
+
*/
|
|
396
|
+
protected createPaginationServiceAccess(): PaginationServiceAccess;
|
|
397
|
+
protected request<T>(method: string, path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
398
|
+
protected requestWithSpec<T>(spec: RequestSpec): Promise<ApiResponse<T>>;
|
|
399
|
+
protected get<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
400
|
+
protected post<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
401
|
+
protected put<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
402
|
+
protected patch<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
403
|
+
protected delete<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
404
|
+
/**
|
|
405
|
+
* Execute a request with cursor-based pagination
|
|
406
|
+
*/
|
|
407
|
+
protected requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
|
|
408
|
+
/**
|
|
409
|
+
* Validates and prepares pagination parameters from options
|
|
410
|
+
*/
|
|
411
|
+
private validateAndPreparePaginationParams;
|
|
412
|
+
/**
|
|
413
|
+
* Prepares request parameters for pagination based on pagination type
|
|
414
|
+
*/
|
|
415
|
+
private preparePaginationRequestParams;
|
|
416
|
+
/**
|
|
417
|
+
* Creates a paginated response from API response
|
|
418
|
+
*/
|
|
419
|
+
private createPaginatedResponseFromResponse;
|
|
420
|
+
/**
|
|
421
|
+
* Determines if there are more pages based on pagination type and metadata
|
|
422
|
+
*/
|
|
423
|
+
private determineHasMorePages;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Entity field type names
|
|
428
|
+
*/
|
|
429
|
+
declare enum EntityFieldDataType {
|
|
430
|
+
UUID = "UUID",
|
|
431
|
+
STRING = "STRING",
|
|
432
|
+
INTEGER = "INTEGER",
|
|
433
|
+
DATETIME = "DATETIME",
|
|
434
|
+
DATETIME_WITH_TZ = "DATETIME_WITH_TZ",
|
|
435
|
+
DECIMAL = "DECIMAL",
|
|
436
|
+
FLOAT = "FLOAT",
|
|
437
|
+
DOUBLE = "DOUBLE",
|
|
438
|
+
DATE = "DATE",
|
|
439
|
+
BOOLEAN = "BOOLEAN",
|
|
440
|
+
BIG_INTEGER = "BIG_INTEGER",
|
|
441
|
+
MULTILINE_TEXT = "MULTILINE_TEXT"
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Represents a single entity record
|
|
445
|
+
*/
|
|
446
|
+
interface EntityRecord {
|
|
447
|
+
/**
|
|
448
|
+
* Unique identifier for the record
|
|
449
|
+
*/
|
|
450
|
+
id: string;
|
|
451
|
+
/**
|
|
452
|
+
* Additional dynamic fields for the entity
|
|
453
|
+
*/
|
|
454
|
+
[key: string]: any;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Options for getting an entity by Id
|
|
458
|
+
*/
|
|
459
|
+
type EntityGetRecordsByIdOptions = {
|
|
460
|
+
/** Level of entity expansion (default: 0) */
|
|
461
|
+
expansionLevel?: number;
|
|
462
|
+
} & PaginationOptions;
|
|
463
|
+
/**
|
|
464
|
+
* Common options for entity operations that modify multiple records
|
|
465
|
+
*/
|
|
466
|
+
interface EntityOperationOptions {
|
|
467
|
+
/** Level of entity expansion (default: 0) */
|
|
468
|
+
expansionLevel?: number;
|
|
469
|
+
/** Whether to fail on first error (default: false) */
|
|
470
|
+
failOnFirst?: boolean;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Options for inserting data into an entity
|
|
474
|
+
*/
|
|
475
|
+
type EntityInsertOptions = EntityOperationOptions;
|
|
476
|
+
/**
|
|
477
|
+
* Options for updating data in an entity
|
|
478
|
+
*/
|
|
479
|
+
type EntityUpdateOptions = EntityOperationOptions;
|
|
480
|
+
/**
|
|
481
|
+
* Options for deleting data from an entity
|
|
482
|
+
*/
|
|
483
|
+
interface EntityDeleteOptions {
|
|
484
|
+
/** Whether to fail on first error (default: false) */
|
|
485
|
+
failOnFirst?: boolean;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Represents a failure record in an entity operation
|
|
489
|
+
*/
|
|
490
|
+
interface FailureRecord {
|
|
491
|
+
/** Error message */
|
|
492
|
+
error?: string;
|
|
493
|
+
/** Original record that failed */
|
|
494
|
+
record?: Record<string, any>;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Response from an entity operation that modifies multiple records
|
|
498
|
+
*/
|
|
499
|
+
interface EntityOperationResponse {
|
|
500
|
+
/** Records that were successfully processed */
|
|
501
|
+
successRecords: Record<string, any>[];
|
|
502
|
+
/** Records that failed processing */
|
|
503
|
+
failureRecords: FailureRecord[];
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Response from inserting data into an entity
|
|
507
|
+
*/
|
|
508
|
+
type EntityInsertResponse = EntityOperationResponse;
|
|
509
|
+
/**
|
|
510
|
+
* Response from updating data in an entity
|
|
511
|
+
*/
|
|
512
|
+
type EntityUpdateResponse = EntityOperationResponse;
|
|
513
|
+
/**
|
|
514
|
+
* Response from deleting data from an entity
|
|
515
|
+
*/
|
|
516
|
+
type EntityDeleteResponse = EntityOperationResponse;
|
|
517
|
+
/**
|
|
518
|
+
* Entity type enum
|
|
519
|
+
*/
|
|
520
|
+
declare enum EntityType {
|
|
521
|
+
Entity = "Entity",
|
|
522
|
+
ChoiceSet = "ChoiceSet",
|
|
523
|
+
InternalEntity = "InternalEntity",
|
|
524
|
+
SystemEntity = "SystemEntity"
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Field type metadata
|
|
528
|
+
*/
|
|
529
|
+
interface FieldDataType {
|
|
530
|
+
name: EntityFieldDataType;
|
|
531
|
+
lengthLimit?: number;
|
|
532
|
+
maxValue?: number;
|
|
533
|
+
minValue?: number;
|
|
534
|
+
decimalPrecision?: number;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Reference types for fields
|
|
538
|
+
*/
|
|
539
|
+
declare enum ReferenceType {
|
|
540
|
+
ManyToOne = "ManyToOne"
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Field display types
|
|
544
|
+
*/
|
|
545
|
+
declare enum FieldDisplayType {
|
|
546
|
+
Basic = "Basic",
|
|
547
|
+
Relationship = "Relationship",
|
|
548
|
+
File = "File",
|
|
549
|
+
ChoiceSetSingle = "ChoiceSetSingle",
|
|
550
|
+
ChoiceSetMultiple = "ChoiceSetMultiple",
|
|
551
|
+
AutoNumber = "AutoNumber"
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Data direction type for external fields
|
|
555
|
+
*/
|
|
556
|
+
declare enum DataDirectionType {
|
|
557
|
+
ReadOnly = "ReadOnly",
|
|
558
|
+
ReadAndWrite = "ReadAndWrite"
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Join type for source join criteria
|
|
562
|
+
*/
|
|
563
|
+
declare enum JoinType {
|
|
564
|
+
LeftJoin = "LeftJoin"
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Field reference with ID
|
|
568
|
+
*/
|
|
569
|
+
interface Field {
|
|
570
|
+
id: string;
|
|
571
|
+
definition?: FieldMetaData;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Detailed field definition
|
|
575
|
+
*/
|
|
576
|
+
interface FieldMetaData {
|
|
577
|
+
id: string;
|
|
578
|
+
name: string;
|
|
579
|
+
isPrimaryKey: boolean;
|
|
580
|
+
isForeignKey: boolean;
|
|
581
|
+
isExternalField: boolean;
|
|
582
|
+
isHiddenField: boolean;
|
|
583
|
+
isUnique: boolean;
|
|
584
|
+
referenceName?: string;
|
|
585
|
+
referenceEntity?: RawEntityGetResponse;
|
|
586
|
+
referenceChoiceSet?: RawEntityGetResponse;
|
|
587
|
+
referenceField?: Field;
|
|
588
|
+
referenceType: ReferenceType;
|
|
589
|
+
fieldDataType: FieldDataType;
|
|
590
|
+
isRequired: boolean;
|
|
591
|
+
displayName: string;
|
|
592
|
+
description: string;
|
|
593
|
+
createdTime: string;
|
|
594
|
+
createdBy: string;
|
|
595
|
+
updatedTime: string;
|
|
596
|
+
updatedBy?: string;
|
|
597
|
+
isSystemField: boolean;
|
|
598
|
+
fieldDisplayType?: FieldDisplayType;
|
|
599
|
+
choiceSetId?: string;
|
|
600
|
+
defaultValue?: string;
|
|
601
|
+
isAttachment: boolean;
|
|
602
|
+
isRbacEnabled: boolean;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* External object details
|
|
606
|
+
*/
|
|
607
|
+
interface ExternalObject {
|
|
608
|
+
id: string;
|
|
609
|
+
externalObjectName?: string;
|
|
610
|
+
externalObjectDisplayName?: string;
|
|
611
|
+
primaryKey?: string;
|
|
612
|
+
externalConnectionId: string;
|
|
613
|
+
entityId?: string;
|
|
614
|
+
isPrimarySource: boolean;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* External connection details
|
|
618
|
+
*/
|
|
619
|
+
interface ExternalConnection {
|
|
620
|
+
id: string;
|
|
621
|
+
connectionId: string;
|
|
622
|
+
elementInstanceId: number;
|
|
623
|
+
folderKey: string;
|
|
624
|
+
connectorKey?: string;
|
|
625
|
+
connectorName?: string;
|
|
626
|
+
connectionName?: string;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* External field mapping
|
|
630
|
+
*/
|
|
631
|
+
interface ExternalFieldMapping {
|
|
632
|
+
id: string;
|
|
633
|
+
externalFieldName?: string;
|
|
634
|
+
externalFieldDisplayName?: string;
|
|
635
|
+
externalObjectId: string;
|
|
636
|
+
externalFieldType?: string;
|
|
637
|
+
internalFieldId: string;
|
|
638
|
+
directionType: DataDirectionType;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* External field
|
|
642
|
+
*/
|
|
643
|
+
interface ExternalField {
|
|
644
|
+
fieldMetaData: FieldMetaData;
|
|
645
|
+
externalFieldMappingDetail: ExternalFieldMapping;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* External source fields
|
|
649
|
+
*/
|
|
650
|
+
interface ExternalSourceFields {
|
|
651
|
+
fields?: ExternalField[];
|
|
652
|
+
externalObjectDetail?: ExternalObject;
|
|
653
|
+
externalConnectionDetail?: ExternalConnection;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Source join criteria
|
|
657
|
+
*/
|
|
658
|
+
interface SourceJoinCriteria {
|
|
659
|
+
id: string;
|
|
660
|
+
entityId: string;
|
|
661
|
+
joinFieldName?: string;
|
|
662
|
+
joinType: JoinType;
|
|
663
|
+
relatedSourceObjectId?: string;
|
|
664
|
+
relatedSourceFieldName?: string;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Entity metadata returned by getById
|
|
668
|
+
*/
|
|
669
|
+
interface RawEntityGetResponse {
|
|
670
|
+
name: string;
|
|
671
|
+
displayName: string;
|
|
672
|
+
entityType: EntityType;
|
|
673
|
+
description: string;
|
|
674
|
+
fields: FieldMetaData[];
|
|
675
|
+
externalFields?: ExternalSourceFields[];
|
|
676
|
+
sourceJoinCriterias?: SourceJoinCriteria[];
|
|
677
|
+
recordCount?: number;
|
|
678
|
+
storageSizeInMB?: number;
|
|
679
|
+
usedStorageSizeInMB?: number;
|
|
680
|
+
attachmentSizeInByte?: number;
|
|
681
|
+
isRbacEnabled: boolean;
|
|
682
|
+
id: string;
|
|
683
|
+
createdBy: string;
|
|
684
|
+
createdTime: string;
|
|
685
|
+
updatedTime?: string;
|
|
686
|
+
updatedBy?: string;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Service for managing UiPath Data Fabric Entities.
|
|
691
|
+
*
|
|
692
|
+
* Entities are collections of records that can be used to store and manage data in the Data Fabric. [UiPath Data Fabric Guide](https://docs.uipath.com/data-service/automation-cloud/latest/user-guide/introduction)
|
|
693
|
+
*
|
|
694
|
+
*/
|
|
695
|
+
interface EntityServiceModel {
|
|
696
|
+
/**
|
|
697
|
+
* Gets all entities in the system
|
|
698
|
+
*
|
|
699
|
+
* @returns Promise resolving to either an array of entities NonPaginatedResponse<EntityGetResponse> or a PaginatedResponse<EntityGetResponse> when pagination options are used.
|
|
700
|
+
* {@link EntityGetResponse}
|
|
701
|
+
* @example
|
|
702
|
+
* ```typescript
|
|
703
|
+
* // Get all entities
|
|
704
|
+
* const entities = await sdk.entities.getAll();
|
|
705
|
+
*
|
|
706
|
+
* // Iterate through entities
|
|
707
|
+
* entities.forEach(entity => {
|
|
708
|
+
* console.log(`Entity: ${entity.displayName} (${entity.name})`);
|
|
709
|
+
* console.log(`Type: ${entity.entityType}`);
|
|
710
|
+
* });
|
|
711
|
+
*
|
|
712
|
+
* // Find a specific entity by name
|
|
713
|
+
* const customerEntity = entities.find(e => e.name === 'Customer');
|
|
714
|
+
*
|
|
715
|
+
* // Use entity methods directly
|
|
716
|
+
* if (customerEntity) {
|
|
717
|
+
* const records = await customerEntity.getRecords();
|
|
718
|
+
* console.log(`Customer records: ${records.items.length}`);
|
|
719
|
+
*
|
|
720
|
+
* const insertResult = await customerEntity.insert([
|
|
721
|
+
* { name: "John", age: 30 }
|
|
722
|
+
* ]);
|
|
723
|
+
* }
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
getAll(): Promise<EntityGetResponse[]>;
|
|
727
|
+
/**
|
|
728
|
+
* Gets entity metadata by entity ID with attached operation methods
|
|
729
|
+
*
|
|
730
|
+
* @param id - UUID of the entity
|
|
731
|
+
* @returns Promise resolving to entity metadata with operation methods
|
|
732
|
+
* {@link EntityGetResponse}
|
|
733
|
+
* @example
|
|
734
|
+
* ```typescript
|
|
735
|
+
* // Get entity metadata with methods
|
|
736
|
+
* const entity = await sdk.entities.getById(<entityId>);
|
|
737
|
+
*
|
|
738
|
+
* // Call operations directly on the entity
|
|
739
|
+
* const records = await entity.getRecords();
|
|
740
|
+
*
|
|
741
|
+
* const insertResult = await entity.insert([
|
|
742
|
+
* { name: "John", age: 30 }
|
|
743
|
+
* ]);
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
getById(id: string): Promise<EntityGetResponse>;
|
|
747
|
+
/**
|
|
748
|
+
* Gets entity records by entity ID
|
|
749
|
+
*
|
|
750
|
+
* @param entityId - UUID of the entity
|
|
751
|
+
* @param options - Query options
|
|
752
|
+
* @returns Promise resolving to either an array of entity records NonPaginatedResponse<EntityRecord> or a PaginatedResponse<EntityRecord> when pagination options are used.
|
|
753
|
+
* {@link EntityRecord}
|
|
754
|
+
* @example
|
|
755
|
+
* ```typescript
|
|
756
|
+
* // Basic usage (non-paginated)
|
|
757
|
+
* const records = await sdk.entities.getRecordsById(<entityId>);
|
|
758
|
+
*
|
|
759
|
+
* // With expansion level
|
|
760
|
+
* const records = await sdk.entities.getRecordsById(<entityId>, {
|
|
761
|
+
* expansionLevel: 1
|
|
762
|
+
* });
|
|
763
|
+
*
|
|
764
|
+
* // With pagination
|
|
765
|
+
* const paginatedResponse = await sdk.entities.getRecordsById(<entityId>, {
|
|
766
|
+
* pageSize: 50,
|
|
767
|
+
* expansionLevel: 1
|
|
768
|
+
* });
|
|
769
|
+
*
|
|
770
|
+
* // Navigate to next page
|
|
771
|
+
* const nextPage = await sdk.entities.getRecordsById(<entityId>, {
|
|
772
|
+
* cursor: paginatedResponse.nextCursor,
|
|
773
|
+
* expansionLevel: 1
|
|
774
|
+
* });
|
|
775
|
+
* ```
|
|
776
|
+
*/
|
|
777
|
+
getRecordsById<T extends EntityGetRecordsByIdOptions = EntityGetRecordsByIdOptions>(entityId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
|
|
778
|
+
/**
|
|
779
|
+
* Inserts data into an entity by entity ID
|
|
780
|
+
*
|
|
781
|
+
* @param id - UUID of the entity
|
|
782
|
+
* @param data - Array of records to insert
|
|
783
|
+
* @param options - Insert options
|
|
784
|
+
* @returns Promise resolving to insert response
|
|
785
|
+
* {@link EntityInsertResponse}
|
|
786
|
+
* @example
|
|
787
|
+
* ```typescript
|
|
788
|
+
* // Basic usage
|
|
789
|
+
* const result = await sdk.entities.insertById(<entityId>, [
|
|
790
|
+
* { name: "John", age: 30 },
|
|
791
|
+
* { name: "Jane", age: 25 }
|
|
792
|
+
* ]);
|
|
793
|
+
*
|
|
794
|
+
* // With options
|
|
795
|
+
* const result = await sdk.entities.insertById(<entityId>, [
|
|
796
|
+
* { name: "John", age: 30 },
|
|
797
|
+
* { name: "Jane", age: 25 }
|
|
798
|
+
* ], {
|
|
799
|
+
* expansionLevel: 1,
|
|
800
|
+
* failOnFirst: true
|
|
801
|
+
* });
|
|
802
|
+
* ```
|
|
803
|
+
*/
|
|
804
|
+
insertById(id: string, data: Record<string, any>[], options?: EntityInsertOptions): Promise<EntityInsertResponse>;
|
|
805
|
+
/**
|
|
806
|
+
* Updates data in an entity by entity ID
|
|
807
|
+
*
|
|
808
|
+
* @param id - UUID of the entity
|
|
809
|
+
* @param data - Array of records to update. Each record MUST contain the record Id.
|
|
810
|
+
* @param options - Update options
|
|
811
|
+
* @returns Promise resolving to update response
|
|
812
|
+
* {@link EntityUpdateResponse}
|
|
813
|
+
* @example
|
|
814
|
+
* ```typescript
|
|
815
|
+
* // Basic usage
|
|
816
|
+
* const result = await sdk.entities.updateById(<entityId>, [
|
|
817
|
+
* { Id: "123", name: "John Updated", age: 31 },
|
|
818
|
+
* { Id: "456", name: "Jane Updated", age: 26 }
|
|
819
|
+
* ]);
|
|
820
|
+
*
|
|
821
|
+
* // With options
|
|
822
|
+
* const result = await sdk.entities.updateById(<entityId>, [
|
|
823
|
+
* { Id: "123", name: "John Updated", age: 31 },
|
|
824
|
+
* { Id: "456", name: "Jane Updated", age: 26 }
|
|
825
|
+
* ], {
|
|
826
|
+
* expansionLevel: 1,
|
|
827
|
+
* failOnFirst: true
|
|
828
|
+
* });
|
|
829
|
+
* ```
|
|
830
|
+
*/
|
|
831
|
+
updateById(id: string, data: EntityRecord[], options?: EntityUpdateOptions): Promise<EntityUpdateResponse>;
|
|
832
|
+
/**
|
|
833
|
+
* Deletes data from an entity by entity ID
|
|
834
|
+
*
|
|
835
|
+
* @param id - UUID of the entity
|
|
836
|
+
* @param recordIds - Array of record UUIDs to delete
|
|
837
|
+
* @param options - Delete options
|
|
838
|
+
* @returns Promise resolving to delete response
|
|
839
|
+
* {@link EntityDeleteResponse}
|
|
840
|
+
* @example
|
|
841
|
+
* ```typescript
|
|
842
|
+
* // Basic usage
|
|
843
|
+
* const result = await sdk.entities.deleteById(<entityId>, [
|
|
844
|
+
* <recordId-1>, <recordId-2>
|
|
845
|
+
* ]);
|
|
846
|
+
* ```
|
|
847
|
+
*/
|
|
848
|
+
deleteById(id: string, recordIds: string[], options?: EntityDeleteOptions): Promise<EntityDeleteResponse>;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Entity methods interface - defines operations that can be performed on an entity
|
|
852
|
+
*/
|
|
853
|
+
interface EntityMethods {
|
|
854
|
+
/**
|
|
855
|
+
* Insert data into this entity
|
|
856
|
+
*
|
|
857
|
+
* @param data - Array of records to insert
|
|
858
|
+
* @param options - Insert options
|
|
859
|
+
* @returns Promise resolving to insert response
|
|
860
|
+
*/
|
|
861
|
+
insert(data: Record<string, any>[], options?: EntityInsertOptions): Promise<EntityInsertResponse>;
|
|
862
|
+
/**
|
|
863
|
+
* Update data in this entity
|
|
864
|
+
*
|
|
865
|
+
* @param data - Array of records to update. Each record MUST contain the record Id,
|
|
866
|
+
* otherwise the update will fail.
|
|
867
|
+
* @param options - Update options
|
|
868
|
+
* @returns Promise resolving to update response
|
|
869
|
+
*/
|
|
870
|
+
update(data: EntityRecord[], options?: EntityUpdateOptions): Promise<EntityUpdateResponse>;
|
|
871
|
+
/**
|
|
872
|
+
* Delete data from this entity
|
|
873
|
+
*
|
|
874
|
+
* @param recordIds - Array of record UUIDs to delete
|
|
875
|
+
* @param options - Delete options
|
|
876
|
+
* @returns Promise resolving to delete response
|
|
877
|
+
*/
|
|
878
|
+
delete(recordIds: string[], options?: EntityDeleteOptions): Promise<EntityDeleteResponse>;
|
|
879
|
+
/**
|
|
880
|
+
* Get records from this entity
|
|
881
|
+
*
|
|
882
|
+
* @param options - Query options
|
|
883
|
+
* @returns Promise resolving to query response
|
|
884
|
+
*/
|
|
885
|
+
getRecords<T extends EntityGetRecordsByIdOptions = EntityGetRecordsByIdOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Entity with methods combining metadata with operation methods
|
|
889
|
+
*/
|
|
890
|
+
type EntityGetResponse = RawEntityGetResponse & EntityMethods;
|
|
891
|
+
/**
|
|
892
|
+
* Creates an actionable entity metadata by combining entity with operational methods
|
|
893
|
+
*
|
|
894
|
+
* @param entityData - Entity metadata
|
|
895
|
+
* @param service - The entity service instance
|
|
896
|
+
* @returns Entity metadata with added methods
|
|
897
|
+
*/
|
|
898
|
+
declare function createEntityWithMethods(entityData: RawEntityGetResponse, service: EntityServiceModel): EntityGetResponse;
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Service for interacting with the Data Fabric Entity API
|
|
902
|
+
*/
|
|
903
|
+
declare class EntityService extends BaseService implements EntityServiceModel {
|
|
904
|
+
/**
|
|
905
|
+
* @hideconstructor
|
|
906
|
+
*/
|
|
907
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager);
|
|
908
|
+
/**
|
|
909
|
+
* Gets entity metadata by entity ID with attached operation methods
|
|
910
|
+
*
|
|
911
|
+
* @param id - UUID of the entity
|
|
912
|
+
* @returns Promise resolving to entity metadata with schema information and operation methods
|
|
913
|
+
*
|
|
914
|
+
* @example
|
|
915
|
+
* ```typescript
|
|
916
|
+
* // Get entity metadata with methods
|
|
917
|
+
* const entity = await sdk.entities.getById("<entityId>");
|
|
918
|
+
*
|
|
919
|
+
* // Call operations directly on the entity
|
|
920
|
+
* const records = await entity.getRecords();
|
|
921
|
+
*
|
|
922
|
+
* const insertResult = await entity.insert([
|
|
923
|
+
* { name: "John", age: 30 }
|
|
924
|
+
* ]);
|
|
925
|
+
* ```
|
|
926
|
+
*/
|
|
927
|
+
getById(id: string): Promise<EntityGetResponse>;
|
|
928
|
+
/**
|
|
929
|
+
* Orchestrates all field mapping transformations
|
|
930
|
+
*
|
|
931
|
+
* @param metadata - Entity metadata to transform
|
|
932
|
+
* @private
|
|
933
|
+
*/
|
|
934
|
+
private applyFieldMappings;
|
|
935
|
+
/**
|
|
936
|
+
* Maps SQL field types to friendly EntityFieldTypes
|
|
937
|
+
*
|
|
938
|
+
* @param metadata - Entity metadata with fields
|
|
939
|
+
* @private
|
|
940
|
+
*/
|
|
941
|
+
private mapFieldTypes;
|
|
942
|
+
/**
|
|
943
|
+
* Transforms nested reference objects in field metadata
|
|
944
|
+
*/
|
|
945
|
+
private transformNestedReferences;
|
|
946
|
+
/**
|
|
947
|
+
* Maps external field names to consistent naming
|
|
948
|
+
*
|
|
949
|
+
* @param metadata - Entity metadata with externalFields
|
|
950
|
+
* @private
|
|
951
|
+
*/
|
|
952
|
+
private mapExternalFields;
|
|
953
|
+
/**
|
|
954
|
+
* Gets entity records by entity ID
|
|
955
|
+
*
|
|
956
|
+
* @param entityId - UUID of the entity
|
|
957
|
+
* @param options - Query options including expansionLevel and pagination options
|
|
958
|
+
* @returns Promise resolving to an array of entity records or paginated response
|
|
959
|
+
*
|
|
960
|
+
* @example
|
|
961
|
+
* ```typescript
|
|
962
|
+
* // Basic usage (non-paginated)
|
|
963
|
+
* const records = await sdk.entities.getRecordsById(<entityId>);
|
|
964
|
+
*
|
|
965
|
+
* // With expansion level
|
|
966
|
+
* const records = await sdk.entities.getRecordsById(<entityId>, {
|
|
967
|
+
* expansionLevel: 1
|
|
968
|
+
* });
|
|
969
|
+
*
|
|
970
|
+
* // With pagination
|
|
971
|
+
* const paginatedResponse = await sdk.entities.getRecordsById(<entityId>, {
|
|
972
|
+
* pageSize: 50,
|
|
973
|
+
* expansionLevel: 1
|
|
974
|
+
* });
|
|
975
|
+
*
|
|
976
|
+
* // Navigate to next page
|
|
977
|
+
* const nextPage = await sdk.entities.getRecordsById(<entityId>, {
|
|
978
|
+
* cursor: paginatedResponse.nextCursor,
|
|
979
|
+
* expansionLevel: 1
|
|
980
|
+
* });
|
|
981
|
+
* ```
|
|
982
|
+
*/
|
|
983
|
+
getRecordsById<T extends EntityGetRecordsByIdOptions = EntityGetRecordsByIdOptions>(entityId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>;
|
|
984
|
+
/**
|
|
985
|
+
* Inserts data into an entity by entity ID
|
|
986
|
+
*
|
|
987
|
+
* @param entityId - UUID of the entity
|
|
988
|
+
* @param data - Array of records to insert
|
|
989
|
+
* @param options - Insert options
|
|
990
|
+
* @returns Promise resolving to insert response
|
|
991
|
+
*
|
|
992
|
+
* @example
|
|
993
|
+
* ```typescript
|
|
994
|
+
* // Basic usage
|
|
995
|
+
* const result = await sdk.entities.insertById(<entityId>, [
|
|
996
|
+
* { name: "John", age: 30 },
|
|
997
|
+
* { name: "Jane", age: 25 }
|
|
998
|
+
* ]);
|
|
999
|
+
*
|
|
1000
|
+
* // With options
|
|
1001
|
+
* const result = await sdk.entities.insertById(<entityId>, [
|
|
1002
|
+
* { name: "John", age: 30 },
|
|
1003
|
+
* { name: "Jane", age: 25 }
|
|
1004
|
+
* ], {
|
|
1005
|
+
* expansionLevel: 1,
|
|
1006
|
+
* failOnFirst: true
|
|
1007
|
+
* });
|
|
1008
|
+
* ```
|
|
1009
|
+
*/
|
|
1010
|
+
insertById(id: string, data: Record<string, any>[], options?: EntityInsertOptions): Promise<EntityInsertResponse>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Updates data in an entity by entity ID
|
|
1013
|
+
*
|
|
1014
|
+
* @param entityId - UUID of the entity
|
|
1015
|
+
* @param data - Array of records to update. Each record MUST contain the record Id,
|
|
1016
|
+
* otherwise the update will fail.
|
|
1017
|
+
* @param options - Update options
|
|
1018
|
+
* @returns Promise resolving to update response
|
|
1019
|
+
*
|
|
1020
|
+
* @example
|
|
1021
|
+
* ```typescript
|
|
1022
|
+
* // Basic usage
|
|
1023
|
+
* const result = await sdk.entities.updateById(<entityId>, [
|
|
1024
|
+
* { Id: "123", name: "John Updated", age: 31 },
|
|
1025
|
+
* { Id: "456", name: "Jane Updated", age: 26 }
|
|
1026
|
+
* ]);
|
|
1027
|
+
*
|
|
1028
|
+
* // With options
|
|
1029
|
+
* const result = await sdk.entities.updateById(<entityId>, [
|
|
1030
|
+
* { Id: "123", name: "John Updated", age: 31 },
|
|
1031
|
+
* { Id: "456", name: "Jane Updated", age: 26 }
|
|
1032
|
+
* ], {
|
|
1033
|
+
* expansionLevel: 1,
|
|
1034
|
+
* failOnFirst: true
|
|
1035
|
+
* });
|
|
1036
|
+
* ```
|
|
1037
|
+
*/
|
|
1038
|
+
updateById(id: string, data: EntityRecord[], options?: EntityUpdateOptions): Promise<EntityUpdateResponse>;
|
|
1039
|
+
/**
|
|
1040
|
+
* Deletes data from an entity by entity ID
|
|
1041
|
+
*
|
|
1042
|
+
* @param entityId - UUID of the entity
|
|
1043
|
+
* @param recordIds - Array of record UUIDs to delete
|
|
1044
|
+
* @param options - Delete options
|
|
1045
|
+
* @returns Promise resolving to delete response
|
|
1046
|
+
*
|
|
1047
|
+
* @example
|
|
1048
|
+
* ```typescript
|
|
1049
|
+
* // Basic usage
|
|
1050
|
+
* const result = await sdk.entities.deleteById(<entityId>, [
|
|
1051
|
+
* <recordId-1>, <recordId-2>
|
|
1052
|
+
* ]);
|
|
1053
|
+
* ```
|
|
1054
|
+
*/
|
|
1055
|
+
deleteById(id: string, recordIds: string[], options?: EntityDeleteOptions): Promise<EntityDeleteResponse>;
|
|
1056
|
+
/**
|
|
1057
|
+
* Gets all entities in the system
|
|
1058
|
+
*
|
|
1059
|
+
* @returns Promise resolving to an array of entity metadata
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* ```typescript
|
|
1063
|
+
* // Get all entities
|
|
1064
|
+
* const entities = await sdk.entities.getAll();
|
|
1065
|
+
*
|
|
1066
|
+
* // Call operations on an entity
|
|
1067
|
+
* const records = await entities[0].getRecords();
|
|
1068
|
+
* ```
|
|
1069
|
+
*/
|
|
1070
|
+
getAll(): Promise<EntityGetResponse[]>;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* Maestro Process Types
|
|
1075
|
+
* Types and interfaces for Maestro process management
|
|
1076
|
+
*/
|
|
1077
|
+
/**
|
|
1078
|
+
* Process information with instance statistics
|
|
1079
|
+
*/
|
|
1080
|
+
interface MaestroProcessGetAllResponse {
|
|
1081
|
+
/** Unique key identifying the process */
|
|
1082
|
+
processKey: string;
|
|
1083
|
+
/** Package identifier */
|
|
1084
|
+
packageId: string;
|
|
1085
|
+
/** Process name */
|
|
1086
|
+
name: string;
|
|
1087
|
+
/** Folder key where process is located */
|
|
1088
|
+
folderKey: string;
|
|
1089
|
+
/** Folder name */
|
|
1090
|
+
folderName: string;
|
|
1091
|
+
/** Available package versions */
|
|
1092
|
+
packageVersions: string[];
|
|
1093
|
+
/** Total number of versions */
|
|
1094
|
+
versionCount: number;
|
|
1095
|
+
/** Process instance count - pending */
|
|
1096
|
+
pendingCount: number;
|
|
1097
|
+
/** Process instance count - running */
|
|
1098
|
+
runningCount: number;
|
|
1099
|
+
/** Process instance count - completed */
|
|
1100
|
+
completedCount: number;
|
|
1101
|
+
/** Process instance count - paused */
|
|
1102
|
+
pausedCount: number;
|
|
1103
|
+
/** Process instance count - cancelled */
|
|
1104
|
+
cancelledCount: number;
|
|
1105
|
+
/** Process instance count - faulted */
|
|
1106
|
+
faultedCount: number;
|
|
1107
|
+
/** Process instance count - retrying */
|
|
1108
|
+
retryingCount: number;
|
|
1109
|
+
/** Process instance count - resuming */
|
|
1110
|
+
resumingCount: number;
|
|
1111
|
+
/** Process instance count - pausing */
|
|
1112
|
+
pausingCount: number;
|
|
1113
|
+
/** Process instance count - canceling */
|
|
1114
|
+
cancelingCount: number;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Maestro Process Models
|
|
1119
|
+
* Model classes for Maestro processes
|
|
1120
|
+
*/
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* Service for managing UiPath Maestro Processes
|
|
1124
|
+
*
|
|
1125
|
+
* UiPath Maestro is a cloud-native orchestration layer that coordinates bots, AI agents, and humans for seamless, intelligent automation of complex workflows. [UiPath Maestro Guide](https://docs.uipath.com/maestro/automation-cloud/latest/user-guide/introduction-to-maestro)
|
|
1126
|
+
*/
|
|
1127
|
+
interface MaestroProcessesServiceModel {
|
|
1128
|
+
/**
|
|
1129
|
+
* @returns Promise resolving to array of MaestroProcess objects
|
|
1130
|
+
* {@link MaestroProcessGetAllResponse}
|
|
1131
|
+
* @example
|
|
1132
|
+
* ```typescript
|
|
1133
|
+
* // Get all processes
|
|
1134
|
+
* const processes = await sdk.maestro.processes.getAll();
|
|
1135
|
+
*
|
|
1136
|
+
* // Access process information
|
|
1137
|
+
* for (const process of processes) {
|
|
1138
|
+
* console.log(`Process: ${process.processKey}`);
|
|
1139
|
+
* console.log(`Running instances: ${process.runningCount}`);
|
|
1140
|
+
* console.log(`Faulted instances: ${process.faultedCount}`);
|
|
1141
|
+
* }
|
|
1142
|
+
*
|
|
1143
|
+
* ```
|
|
1144
|
+
*/
|
|
1145
|
+
getAll(): Promise<MaestroProcessGetAllResponse[]>;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Constants used throughout the pagination system
|
|
1150
|
+
*/
|
|
1151
|
+
/** Maximum number of items that can be requested in a single page */
|
|
1152
|
+
declare const MAX_PAGE_SIZE = 1000;
|
|
1153
|
+
/** Default page size when jumpToPage is used without specifying pageSize */
|
|
1154
|
+
declare const DEFAULT_PAGE_SIZE = 50;
|
|
1155
|
+
/** Default field name for items in a paginated response */
|
|
1156
|
+
declare const DEFAULT_ITEMS_FIELD = "value";
|
|
1157
|
+
/** Default field name for total count in a paginated response */
|
|
1158
|
+
declare const DEFAULT_TOTAL_COUNT_FIELD = "@odata.count";
|
|
1159
|
+
/**
|
|
1160
|
+
* Limits the page size to the maximum allowed value
|
|
1161
|
+
* @param pageSize - Requested page size
|
|
1162
|
+
* @returns Limited page size value
|
|
1163
|
+
*/
|
|
1164
|
+
declare function getLimitedPageSize(pageSize?: number): number;
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* Process Instance Types
|
|
1168
|
+
* Types and interfaces for Maestro process instance management
|
|
1169
|
+
*/
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
* Response for getting a single process instance
|
|
1173
|
+
*/
|
|
1174
|
+
interface RawProcessInstanceGetResponse {
|
|
1175
|
+
instanceId: string;
|
|
1176
|
+
packageKey: string;
|
|
1177
|
+
packageId: string;
|
|
1178
|
+
packageVersion: string;
|
|
1179
|
+
latestRunId: string;
|
|
1180
|
+
latestRunStatus: string;
|
|
1181
|
+
processKey: string;
|
|
1182
|
+
folderKey: string;
|
|
1183
|
+
userId: number;
|
|
1184
|
+
instanceDisplayName: string;
|
|
1185
|
+
startedByUser: string;
|
|
1186
|
+
source: string;
|
|
1187
|
+
creatorUserKey: string;
|
|
1188
|
+
startedTime: string;
|
|
1189
|
+
completedTime: string | null;
|
|
1190
|
+
instanceRuns: ProcessInstanceRun[];
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Query options for getting process instances
|
|
1194
|
+
*/
|
|
1195
|
+
interface ProcessInstanceGetAllOptions {
|
|
1196
|
+
packageId?: string;
|
|
1197
|
+
packageVersion?: string;
|
|
1198
|
+
processKey?: string;
|
|
1199
|
+
errorCode?: string;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Query options for getting process instances with pagination support
|
|
1203
|
+
*/
|
|
1204
|
+
type ProcessInstanceGetAllWithPaginationOptions = ProcessInstanceGetAllOptions & PaginationOptions;
|
|
1205
|
+
/**
|
|
1206
|
+
* Request for process instance operations (cancel, pause, resume)
|
|
1207
|
+
*/
|
|
1208
|
+
interface ProcessInstanceOperationOptions {
|
|
1209
|
+
comment?: string;
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Response from PIMS operations (cancel, pause, resume)
|
|
1213
|
+
*/
|
|
1214
|
+
interface ProcessInstanceOperationResponse {
|
|
1215
|
+
instanceId: string;
|
|
1216
|
+
status: string;
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Response for process instance execution history
|
|
1220
|
+
*/
|
|
1221
|
+
interface ProcessInstanceExecutionHistoryResponse {
|
|
1222
|
+
id: string;
|
|
1223
|
+
traceId: string;
|
|
1224
|
+
parentId: string | null;
|
|
1225
|
+
name: string;
|
|
1226
|
+
startedTime: string;
|
|
1227
|
+
endTime: string | null;
|
|
1228
|
+
attributes: string | null;
|
|
1229
|
+
createdTime: string;
|
|
1230
|
+
updatedTime?: string;
|
|
1231
|
+
expiredTime: string | null;
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Process Instance run
|
|
1235
|
+
*/
|
|
1236
|
+
interface ProcessInstanceRun {
|
|
1237
|
+
runId: string;
|
|
1238
|
+
status: string;
|
|
1239
|
+
startedTime: string;
|
|
1240
|
+
completedTime: string;
|
|
1241
|
+
}
|
|
1242
|
+
type BpmnXmlString = string;
|
|
1243
|
+
/**
|
|
1244
|
+
* Process Instance element metadata
|
|
1245
|
+
*/
|
|
1246
|
+
interface ElementMetaData {
|
|
1247
|
+
elementId: string;
|
|
1248
|
+
elementRunId: string;
|
|
1249
|
+
isMarker: boolean;
|
|
1250
|
+
inputs: Record<string, any>;
|
|
1251
|
+
inputDefinitions: Record<string, any>;
|
|
1252
|
+
outputs: Record<string, any>;
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Process Instance global variable metadata
|
|
1256
|
+
*/
|
|
1257
|
+
interface GlobalVariableMetaData {
|
|
1258
|
+
id: string;
|
|
1259
|
+
name: string;
|
|
1260
|
+
/**
|
|
1261
|
+
* Common values: "integer", "string", "boolean"
|
|
1262
|
+
* May also contain custom types or "any" when type cannot be determined
|
|
1263
|
+
*/
|
|
1264
|
+
type: string;
|
|
1265
|
+
elementId: string;
|
|
1266
|
+
/** Name of the BPMN node/element */
|
|
1267
|
+
source: string;
|
|
1268
|
+
value: any;
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Response for getting global variables for process instance
|
|
1272
|
+
*/
|
|
1273
|
+
interface ProcessInstanceGetVariablesResponse {
|
|
1274
|
+
elements: ElementMetaData[];
|
|
1275
|
+
globalVariables: GlobalVariableMetaData[];
|
|
1276
|
+
instanceId: string;
|
|
1277
|
+
parentElementId: string | null;
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Options for getting global variables
|
|
1281
|
+
*/
|
|
1282
|
+
interface ProcessInstanceGetVariablesOptions {
|
|
1283
|
+
parentElementId?: string;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
interface CollectionResponse<T> {
|
|
1287
|
+
value: T[];
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Standardized result interface for all operation methods (pause, cancel, complete, update, upload, etc.)
|
|
1291
|
+
* Success responses include data from the request context or API response
|
|
1292
|
+
*/
|
|
1293
|
+
interface OperationResponse<TData> {
|
|
1294
|
+
/**
|
|
1295
|
+
* Whether the operation was successful
|
|
1296
|
+
*/
|
|
1297
|
+
success: boolean;
|
|
1298
|
+
/**
|
|
1299
|
+
* Response data (can contain error details in case of failure)
|
|
1300
|
+
*/
|
|
1301
|
+
data: TData;
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Common enum for job state used across services
|
|
1305
|
+
*/
|
|
1306
|
+
declare enum JobState {
|
|
1307
|
+
Pending = "Pending",
|
|
1308
|
+
Running = "Running",
|
|
1309
|
+
Stopping = "Stopping",
|
|
1310
|
+
Terminating = "Terminating",
|
|
1311
|
+
Faulted = "Faulted",
|
|
1312
|
+
Successful = "Successful",
|
|
1313
|
+
Stopped = "Stopped",
|
|
1314
|
+
Suspended = "Suspended",
|
|
1315
|
+
Resumed = "Resumed"
|
|
1316
|
+
}
|
|
1317
|
+
interface BaseOptions {
|
|
1318
|
+
expand?: string;
|
|
1319
|
+
select?: string;
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Common request options interface used across services for querying data
|
|
1323
|
+
*/
|
|
1324
|
+
interface RequestOptions extends BaseOptions {
|
|
1325
|
+
filter?: string;
|
|
1326
|
+
orderby?: string;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* Service for managing UiPath Maestro Process instances
|
|
1331
|
+
*
|
|
1332
|
+
* Maestro process instances are the running instances of Maestro processes. [UiPath Maestro Process Instances Guide](https://docs.uipath.com/maestro/automation-cloud/latest/user-guide/all-instances-view)
|
|
1333
|
+
*/
|
|
1334
|
+
interface ProcessInstancesServiceModel {
|
|
1335
|
+
/**
|
|
1336
|
+
* Get all process instances with optional filtering and pagination
|
|
1337
|
+
*
|
|
1338
|
+
* The method returns either:
|
|
1339
|
+
* - A NonPaginatedResponse with items array (when no pagination parameters are provided)
|
|
1340
|
+
* - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
|
|
1341
|
+
*
|
|
1342
|
+
* @param options Query parameters for filtering instances and pagination
|
|
1343
|
+
* @returns Promise resolving to either an array of process instances NonPaginatedResponse<ProcessInstanceGetResponse> or a PaginatedResponse<ProcessInstanceGetResponse> when pagination options are used.
|
|
1344
|
+
* {@link ProcessInstanceGetResponse}
|
|
1345
|
+
* @example
|
|
1346
|
+
* ```typescript
|
|
1347
|
+
* // Get all instances (non-paginated)
|
|
1348
|
+
* const instances = await sdk.maestro.processes.instances.getAll();
|
|
1349
|
+
*
|
|
1350
|
+
* // Cancel faulted instances using methods directly on instances
|
|
1351
|
+
* for (const instance of instances.items) {
|
|
1352
|
+
* if (instance.latestRunStatus === 'Faulted') {
|
|
1353
|
+
* await instance.cancel({ comment: 'Cancelling faulted instance' });
|
|
1354
|
+
* }
|
|
1355
|
+
* }
|
|
1356
|
+
*
|
|
1357
|
+
* // With filtering
|
|
1358
|
+
* const instances = await sdk.maestro.processes.instances.getAll({
|
|
1359
|
+
* processKey: 'MyProcess'
|
|
1360
|
+
* });
|
|
1361
|
+
*
|
|
1362
|
+
* // First page with pagination
|
|
1363
|
+
* const page1 = await sdk.maestro.processes.instances.getAll({ pageSize: 10 });
|
|
1364
|
+
*
|
|
1365
|
+
* // Navigate using cursor
|
|
1366
|
+
* if (page1.hasNextPage) {
|
|
1367
|
+
* const page2 = await sdk.maestro.processes.instances.getAll({ cursor: page1.nextCursor });
|
|
1368
|
+
* }
|
|
1369
|
+
* ```
|
|
1370
|
+
*/
|
|
1371
|
+
getAll<T extends ProcessInstanceGetAllWithPaginationOptions = ProcessInstanceGetAllWithPaginationOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ProcessInstanceGetResponse> : NonPaginatedResponse<ProcessInstanceGetResponse>>;
|
|
1372
|
+
/**
|
|
1373
|
+
* Get a process instance by ID with operation methods (cancel, pause, resume)
|
|
1374
|
+
* @param id The ID of the instance to retrieve
|
|
1375
|
+
* @param folderKey The folder key for authorization
|
|
1376
|
+
* @returns Promise resolving to a process instance
|
|
1377
|
+
* {@link ProcessInstanceGetResponse}
|
|
1378
|
+
* @example
|
|
1379
|
+
* ```typescript
|
|
1380
|
+
* // Get a specific process instance
|
|
1381
|
+
* const instance = await sdk.maestro.processes.instances.getById(
|
|
1382
|
+
* <instanceId>,
|
|
1383
|
+
* <folderKey>
|
|
1384
|
+
* );
|
|
1385
|
+
*
|
|
1386
|
+
* // Access instance properties
|
|
1387
|
+
* console.log(`Status: ${instance.latestRunStatus}`);
|
|
1388
|
+
*
|
|
1389
|
+
* ```
|
|
1390
|
+
*/
|
|
1391
|
+
getById(id: string, folderKey: string): Promise<ProcessInstanceGetResponse>;
|
|
1392
|
+
/**
|
|
1393
|
+
* Get execution history (spans) for a process instance
|
|
1394
|
+
* @param instanceId The ID of the instance to get history for
|
|
1395
|
+
* @returns Promise resolving to execution history
|
|
1396
|
+
* {@link ProcessInstanceExecutionHistoryResponse}
|
|
1397
|
+
* @example
|
|
1398
|
+
* ```typescript
|
|
1399
|
+
* // Get execution history for a process instance
|
|
1400
|
+
* const history = await sdk.maestro.processes.instances.getExecutionHistory(
|
|
1401
|
+
* <instanceId>
|
|
1402
|
+
* );
|
|
1403
|
+
*
|
|
1404
|
+
* // Analyze execution timeline
|
|
1405
|
+
* history.forEach(span => {
|
|
1406
|
+
* console.log(`Activity: ${span.name}`);
|
|
1407
|
+
* console.log(`Start: ${span.startTime}`);
|
|
1408
|
+
* console.log(`Duration: ${span.duration}ms`);
|
|
1409
|
+
* });
|
|
1410
|
+
*
|
|
1411
|
+
* ```
|
|
1412
|
+
*/
|
|
1413
|
+
getExecutionHistory(instanceId: string): Promise<ProcessInstanceExecutionHistoryResponse[]>;
|
|
1414
|
+
/**
|
|
1415
|
+
* Get BPMN XML file for a process instance
|
|
1416
|
+
* @param instanceId The ID of the instance to get BPMN for
|
|
1417
|
+
* @param folderKey The folder key for authorization
|
|
1418
|
+
* @returns Promise resolving to BPMN XML file
|
|
1419
|
+
* {@link BpmnXmlString}
|
|
1420
|
+
* @example
|
|
1421
|
+
* ```typescript
|
|
1422
|
+
* // Get BPMN XML for a process instance
|
|
1423
|
+
* const bpmnXml = await sdk.maestro.processes.instances.getBpmn(
|
|
1424
|
+
* <instanceId>,
|
|
1425
|
+
* <folderKey>
|
|
1426
|
+
* );
|
|
1427
|
+
*
|
|
1428
|
+
* // Render BPMN diagram in frontend using bpmn-js
|
|
1429
|
+
* import BpmnViewer from 'bpmn-js/lib/Viewer';
|
|
1430
|
+
*
|
|
1431
|
+
* const viewer = new BpmnViewer({
|
|
1432
|
+
* container: '#bpmn-diagram'
|
|
1433
|
+
* });
|
|
1434
|
+
*
|
|
1435
|
+
* await viewer.importXML(bpmnXml);
|
|
1436
|
+
*
|
|
1437
|
+
* // Zoom to fit the diagram
|
|
1438
|
+
* viewer.get('canvas').zoom('fit-viewport');
|
|
1439
|
+
* ```
|
|
1440
|
+
*/
|
|
1441
|
+
getBpmn(instanceId: string, folderKey: string): Promise<BpmnXmlString>;
|
|
1442
|
+
/**
|
|
1443
|
+
* Cancel a process instance
|
|
1444
|
+
* @param instanceId The ID of the instance to cancel
|
|
1445
|
+
* @param folderKey The folder key for authorization
|
|
1446
|
+
* @param options Optional cancellation options with comment
|
|
1447
|
+
* @returns Promise resolving to operation result with instance data
|
|
1448
|
+
* @example
|
|
1449
|
+
* ```typescript
|
|
1450
|
+
* // Cancel a process instance
|
|
1451
|
+
* const result = await sdk.maestro.processes.instances.cancel(
|
|
1452
|
+
* <instanceId>,
|
|
1453
|
+
* <folderKey>
|
|
1454
|
+
* );
|
|
1455
|
+
*
|
|
1456
|
+
* if (result.success) {
|
|
1457
|
+
* console.log(`Instance ${result.data.instanceId} now has status: ${result.data.status}`);
|
|
1458
|
+
* }
|
|
1459
|
+
*
|
|
1460
|
+
* // Cancel with a comment
|
|
1461
|
+
* const result = await sdk.maestro.processes.instances.cancel(
|
|
1462
|
+
* <instanceId>,
|
|
1463
|
+
* <folderKey>,
|
|
1464
|
+
* { comment: <comment> }
|
|
1465
|
+
* );
|
|
1466
|
+
*
|
|
1467
|
+
* // Cancel multiple faulted instances
|
|
1468
|
+
* const instances = await sdk.maestro.processes.instances.getAll({
|
|
1469
|
+
* latestRunStatus: "Faulted"
|
|
1470
|
+
* });
|
|
1471
|
+
*
|
|
1472
|
+
* for (const instance of instances.items) {
|
|
1473
|
+
* const result = await sdk.maestro.processes.instances.cancel(
|
|
1474
|
+
* instance.instanceId,
|
|
1475
|
+
* instance.folderKey,
|
|
1476
|
+
* { comment: <comment> }
|
|
1477
|
+
* );
|
|
1478
|
+
*
|
|
1479
|
+
* if (result.success) {
|
|
1480
|
+
* console.log(`Cancelled instance: ${result.data.instanceId}`);
|
|
1481
|
+
* }
|
|
1482
|
+
* }
|
|
1483
|
+
* ```
|
|
1484
|
+
*/
|
|
1485
|
+
cancel(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Pause a process instance
|
|
1488
|
+
* @param instanceId The ID of the instance to pause
|
|
1489
|
+
* @param folderKey The folder key for authorization
|
|
1490
|
+
* @param options Optional pause options with comment
|
|
1491
|
+
* @returns Promise resolving to operation result with instance data
|
|
1492
|
+
*/
|
|
1493
|
+
pause(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
|
|
1494
|
+
/**
|
|
1495
|
+
* Resume a process instance
|
|
1496
|
+
* @param instanceId The ID of the instance to resume
|
|
1497
|
+
* @param folderKey The folder key for authorization
|
|
1498
|
+
* @param options Optional resume options with comment
|
|
1499
|
+
* @returns Promise resolving to operation result with instance data
|
|
1500
|
+
*/
|
|
1501
|
+
resume(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
|
|
1502
|
+
/**
|
|
1503
|
+
* Get global variables for a process instance
|
|
1504
|
+
*
|
|
1505
|
+
* @param instanceId The ID of the instance to get variables for
|
|
1506
|
+
* @param folderKey The folder key for authorization
|
|
1507
|
+
* @param options Optional options including parentElementId to filter by parent element
|
|
1508
|
+
* @returns Promise resolving to variables response with elements and globals
|
|
1509
|
+
* {@link ProcessInstanceGetVariablesResponse}
|
|
1510
|
+
* @example
|
|
1511
|
+
* ```typescript
|
|
1512
|
+
* // Get all variables for a process instance
|
|
1513
|
+
* const variables = await sdk.maestro.processes.instances.getVariables(
|
|
1514
|
+
* <instanceId>,
|
|
1515
|
+
* <folderKey>
|
|
1516
|
+
* );
|
|
1517
|
+
*
|
|
1518
|
+
* // Access global variables
|
|
1519
|
+
* console.log('Global variables:', variables.globalVariables);
|
|
1520
|
+
*
|
|
1521
|
+
* // Iterate through global variables with metadata
|
|
1522
|
+
* variables.globalVariables?.forEach(variable => {
|
|
1523
|
+
* console.log(`Variable: ${variable.name} (${variable.id})`);
|
|
1524
|
+
* console.log(` Type: ${variable.type}`);
|
|
1525
|
+
* console.log(` Element: ${variable.elementId}`);
|
|
1526
|
+
* console.log(` Value: ${variable.value}`);
|
|
1527
|
+
* });
|
|
1528
|
+
*
|
|
1529
|
+
* // Get variables for a specific parent element
|
|
1530
|
+
* const variables = await sdk.maestro.processes.instances.getVariables(
|
|
1531
|
+
* <instanceId>,
|
|
1532
|
+
* <folderKey>,
|
|
1533
|
+
* { parentElementId: <parentElementId> }
|
|
1534
|
+
* );
|
|
1535
|
+
* ```
|
|
1536
|
+
*/
|
|
1537
|
+
getVariables(instanceId: string, folderKey: string, options?: ProcessInstanceGetVariablesOptions): Promise<ProcessInstanceGetVariablesResponse>;
|
|
1538
|
+
}
|
|
1539
|
+
interface ProcessInstanceMethods {
|
|
1540
|
+
/**
|
|
1541
|
+
* Cancels this process instance
|
|
1542
|
+
*
|
|
1543
|
+
* @param options - Optional cancellation options with comment
|
|
1544
|
+
* @returns Promise resolving to operation result
|
|
1545
|
+
*/
|
|
1546
|
+
cancel(options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
|
|
1547
|
+
/**
|
|
1548
|
+
* Pauses this process instance
|
|
1549
|
+
*
|
|
1550
|
+
* @param options - Optional pause options with comment
|
|
1551
|
+
* @returns Promise resolving to operation result
|
|
1552
|
+
*/
|
|
1553
|
+
pause(options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
|
|
1554
|
+
/**
|
|
1555
|
+
* Resumes this process instance
|
|
1556
|
+
*
|
|
1557
|
+
* @param options - Optional resume options with comment
|
|
1558
|
+
* @returns Promise resolving to operation result
|
|
1559
|
+
*/
|
|
1560
|
+
resume(options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
|
|
1561
|
+
}
|
|
1562
|
+
type ProcessInstanceGetResponse = RawProcessInstanceGetResponse & ProcessInstanceMethods;
|
|
1563
|
+
/**
|
|
1564
|
+
* Creates an actionable process instance by combining API process instance data with operational methods.
|
|
1565
|
+
*
|
|
1566
|
+
* @param instanceData - The process instance data from API
|
|
1567
|
+
* @param service - The process instance service instance
|
|
1568
|
+
* @returns A process instance object with added methods
|
|
1569
|
+
*/
|
|
1570
|
+
declare function createProcessInstanceWithMethods(instanceData: RawProcessInstanceGetResponse, service: ProcessInstancesServiceModel): ProcessInstanceGetResponse;
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* Service for interacting with Maestro Processes
|
|
1574
|
+
*/
|
|
1575
|
+
declare class MaestroProcessesService extends BaseService implements MaestroProcessesServiceModel {
|
|
1576
|
+
/**
|
|
1577
|
+
* @hideconstructor
|
|
1578
|
+
*/
|
|
1579
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager);
|
|
1580
|
+
/**
|
|
1581
|
+
* Get all processes with their instance statistics
|
|
1582
|
+
* @returns Promise resolving to array of MaestroProcess objects
|
|
1583
|
+
*
|
|
1584
|
+
* @example
|
|
1585
|
+
* ```typescript
|
|
1586
|
+
* // Get all processes
|
|
1587
|
+
* const processes = await sdk.maestro.processes.getAll();
|
|
1588
|
+
*
|
|
1589
|
+
* // Access process information
|
|
1590
|
+
* for (const process of processes) {
|
|
1591
|
+
* console.log(`Process: ${process.processKey}`);
|
|
1592
|
+
* console.log(`Running instances: ${process.runningCount}`);
|
|
1593
|
+
* console.log(`Faulted instances: ${process.faultedCount}`);
|
|
1594
|
+
* }
|
|
1595
|
+
*
|
|
1596
|
+
* ```
|
|
1597
|
+
*/
|
|
1598
|
+
getAll(): Promise<MaestroProcessGetAllResponse[]>;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
declare class ProcessInstancesService extends BaseService implements ProcessInstancesServiceModel {
|
|
1602
|
+
/**
|
|
1603
|
+
* @hideconstructor
|
|
1604
|
+
*/
|
|
1605
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager);
|
|
1606
|
+
/**
|
|
1607
|
+
* Get all process instances with optional filtering and pagination
|
|
1608
|
+
*
|
|
1609
|
+
* The method returns either:
|
|
1610
|
+
* - A NonPaginatedResponse with items array (when no pagination parameters are provided)
|
|
1611
|
+
* - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
|
|
1612
|
+
*
|
|
1613
|
+
* @param options Query parameters for filtering instances and pagination
|
|
1614
|
+
* @returns Promise resolving to process instances or paginated result
|
|
1615
|
+
*
|
|
1616
|
+
* @example
|
|
1617
|
+
* ```typescript
|
|
1618
|
+
* // Get all instances (non-paginated)
|
|
1619
|
+
* const instances = await sdk.maestro.processes.instances.getAll();
|
|
1620
|
+
*
|
|
1621
|
+
* // Cancel faulted instances using methods directly on instances
|
|
1622
|
+
* for (const instance of instances.items) {
|
|
1623
|
+
* if (instance.latestRunStatus === 'Faulted') {
|
|
1624
|
+
* await instance.cancel({ comment: 'Cancelling faulted instance' });
|
|
1625
|
+
* }
|
|
1626
|
+
* }
|
|
1627
|
+
*
|
|
1628
|
+
* // With filtering
|
|
1629
|
+
* const instances = await sdk.maestro.processes.instances.getAll({
|
|
1630
|
+
* processKey: 'MyProcess'
|
|
1631
|
+
* });
|
|
1632
|
+
*
|
|
1633
|
+
* // First page with pagination
|
|
1634
|
+
* const page1 = await sdk.maestro.processes.instances.getAll({ pageSize: 10 });
|
|
1635
|
+
*
|
|
1636
|
+
* // Navigate using cursor
|
|
1637
|
+
* if (page1.hasNextPage) {
|
|
1638
|
+
* const page2 = await sdk.maestro.processes.instances.getAll({ cursor: page1.nextCursor });
|
|
1639
|
+
* }
|
|
1640
|
+
* ```
|
|
1641
|
+
*/
|
|
1642
|
+
getAll<T extends ProcessInstanceGetAllWithPaginationOptions = ProcessInstanceGetAllWithPaginationOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ProcessInstanceGetResponse> : NonPaginatedResponse<ProcessInstanceGetResponse>>;
|
|
1643
|
+
/**
|
|
1644
|
+
* Get a process instance by ID with operation methods (cancel, pause, resume)
|
|
1645
|
+
* @param id The ID of the instance to retrieve
|
|
1646
|
+
* @param folderKey The folder key for authorization
|
|
1647
|
+
* @returns Promise<ProcessInstanceGetResponse>
|
|
1648
|
+
*/
|
|
1649
|
+
getById(id: string, folderKey: string): Promise<ProcessInstanceGetResponse>;
|
|
1650
|
+
/**
|
|
1651
|
+
* Get execution history (spans) for a process instance
|
|
1652
|
+
* @param instanceId The ID of the instance to get history for
|
|
1653
|
+
* @returns Promise<ProcessInstanceExecutionHistoryResponse[]>
|
|
1654
|
+
*/
|
|
1655
|
+
getExecutionHistory(instanceId: string): Promise<ProcessInstanceExecutionHistoryResponse[]>;
|
|
1656
|
+
/**
|
|
1657
|
+
* Get BPMN XML file for a process instance
|
|
1658
|
+
* @param instanceId The ID of the instance to get BPMN for
|
|
1659
|
+
* @param folderKey The folder key for authorization
|
|
1660
|
+
* @returns Promise<BpmnXmlString> The BPMN XML contents as a string
|
|
1661
|
+
*/
|
|
1662
|
+
getBpmn(instanceId: string, folderKey: string): Promise<BpmnXmlString>;
|
|
1663
|
+
/**
|
|
1664
|
+
* Cancel a process instance
|
|
1665
|
+
* @param instanceId The ID of the instance to cancel
|
|
1666
|
+
* @param folderKey The folder key for authorization
|
|
1667
|
+
* @param options Optional cancellation options with comment
|
|
1668
|
+
* @returns Promise resolving to operation result with updated instance data
|
|
1669
|
+
*/
|
|
1670
|
+
cancel(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
|
|
1671
|
+
/**
|
|
1672
|
+
* Pause a process instance
|
|
1673
|
+
* @param instanceId The ID of the instance to pause
|
|
1674
|
+
* @param folderKey The folder key for authorization
|
|
1675
|
+
* @param options Optional pause options with comment
|
|
1676
|
+
* @returns Promise resolving to operation result with updated instance data
|
|
1677
|
+
*/
|
|
1678
|
+
pause(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Resume a process instance
|
|
1681
|
+
* @param instanceId The ID of the instance to resume
|
|
1682
|
+
* @param folderKey The folder key for authorization
|
|
1683
|
+
* @param options Optional resume options with comment
|
|
1684
|
+
* @returns Promise resolving to operation result with updated instance data
|
|
1685
|
+
*/
|
|
1686
|
+
resume(instanceId: string, folderKey: string, options?: ProcessInstanceOperationOptions): Promise<OperationResponse<ProcessInstanceOperationResponse>>;
|
|
1687
|
+
/**
|
|
1688
|
+
* Parses BPMN XML to extract variable metadata from uipath:inputOutput elements
|
|
1689
|
+
* @private
|
|
1690
|
+
* @param bpmnXml The BPMN XML string
|
|
1691
|
+
* @returns Map of variable ID to metadata
|
|
1692
|
+
*/
|
|
1693
|
+
private parseBpmnVariables;
|
|
1694
|
+
/**
|
|
1695
|
+
* Extracts element names from BPMN XML and maps them to their element IDs
|
|
1696
|
+
* @private
|
|
1697
|
+
* @param bpmnXml The BPMN XML string
|
|
1698
|
+
* @returns Map of elementId to element name
|
|
1699
|
+
*/
|
|
1700
|
+
private getVariableSource;
|
|
1701
|
+
/**
|
|
1702
|
+
* Enriches global variables with metadata from BPMN
|
|
1703
|
+
* @private
|
|
1704
|
+
* @param globals The raw globals object from API response
|
|
1705
|
+
* @param variableMetadata The parsed BPMN variable metadata
|
|
1706
|
+
* @returns Array of global variables
|
|
1707
|
+
*/
|
|
1708
|
+
private transformGlobalVariables;
|
|
1709
|
+
/**
|
|
1710
|
+
* Get global variables for a process instance
|
|
1711
|
+
* @param instanceId The ID of the instance to get variables for
|
|
1712
|
+
* @param folderKey The folder key for authorization
|
|
1713
|
+
* @param options Optional options including parentElementId to filter by parent element
|
|
1714
|
+
* @returns Promise<ProcessInstanceGetVariablesResponse>
|
|
1715
|
+
*/
|
|
1716
|
+
getVariables(instanceId: string, folderKey: string, options?: ProcessInstanceGetVariablesOptions): Promise<ProcessInstanceGetVariablesResponse>;
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
/**
|
|
1720
|
+
* Base service for services that need folder-specific functionality
|
|
1721
|
+
*/
|
|
1722
|
+
declare class FolderScopedService extends BaseService {
|
|
1723
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager);
|
|
1724
|
+
/**
|
|
1725
|
+
* Gets resources in a folder with optional query parameters
|
|
1726
|
+
*
|
|
1727
|
+
* @param endpoint - API endpoint to call
|
|
1728
|
+
* @param folderId - required folder ID
|
|
1729
|
+
* @param options - Query options
|
|
1730
|
+
* @param transformFn - Optional function to transform the response data
|
|
1731
|
+
* @returns Promise resolving to an array of resources
|
|
1732
|
+
*/
|
|
1733
|
+
protected _getByFolder<T, R = T>(endpoint: string, folderId: number, options?: Record<string, any>, transformFn?: (item: T) => R): Promise<R[]>;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* Enum for Asset Value Scope
|
|
1738
|
+
*/
|
|
1739
|
+
declare enum AssetValueScope {
|
|
1740
|
+
Global = "Global",
|
|
1741
|
+
PerRobot = "PerRobot"
|
|
1742
|
+
}
|
|
1743
|
+
/**
|
|
1744
|
+
* Enum for Asset Value Type
|
|
1745
|
+
*/
|
|
1746
|
+
declare enum AssetValueType {
|
|
1747
|
+
DBConnectionString = "DBConnectionString",
|
|
1748
|
+
HttpConnectionString = "HttpConnectionString",
|
|
1749
|
+
Text = "Text",
|
|
1750
|
+
Bool = "Bool",
|
|
1751
|
+
Integer = "Integer",
|
|
1752
|
+
Credential = "Credential",
|
|
1753
|
+
WindowsCredential = "WindowsCredential",
|
|
1754
|
+
KeyValueList = "KeyValueList",
|
|
1755
|
+
Secret = "Secret"
|
|
1756
|
+
}
|
|
1757
|
+
/**
|
|
1758
|
+
* Interface for key-value pair used in assets
|
|
1759
|
+
*/
|
|
1760
|
+
interface CustomKeyValuePair {
|
|
1761
|
+
key?: string;
|
|
1762
|
+
value?: string;
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Interface for asset response
|
|
1766
|
+
*/
|
|
1767
|
+
interface AssetGetResponse {
|
|
1768
|
+
key: string;
|
|
1769
|
+
name: string;
|
|
1770
|
+
id: number;
|
|
1771
|
+
canBeDeleted: boolean;
|
|
1772
|
+
valueScope: AssetValueScope;
|
|
1773
|
+
valueType: AssetValueType;
|
|
1774
|
+
value: string | null;
|
|
1775
|
+
credentialStoreId: number | null;
|
|
1776
|
+
keyValueList: CustomKeyValuePair[];
|
|
1777
|
+
hasDefaultValue: boolean;
|
|
1778
|
+
description: string | null;
|
|
1779
|
+
foldersCount: number;
|
|
1780
|
+
lastModifiedTime: string | null;
|
|
1781
|
+
lastModifierUserId: number | null;
|
|
1782
|
+
createdTime: string;
|
|
1783
|
+
creatorUserId: number;
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Options for getting assets across folders
|
|
1787
|
+
*/
|
|
1788
|
+
type AssetGetAllOptions = RequestOptions & PaginationOptions & {
|
|
1789
|
+
/**
|
|
1790
|
+
* Optional folder ID to filter assets by folder
|
|
1791
|
+
*/
|
|
1792
|
+
folderId?: number;
|
|
1793
|
+
};
|
|
1794
|
+
/**
|
|
1795
|
+
* Options for getting a single asset by ID
|
|
1796
|
+
*/
|
|
1797
|
+
type AssetGetByIdOptions = BaseOptions;
|
|
1798
|
+
|
|
1799
|
+
/**
|
|
1800
|
+
* Service for managing UiPath Assets.
|
|
1801
|
+
*
|
|
1802
|
+
* Assets are key-value pairs that can be used to store configuration data, credentials, and other settings used by automation processes. [UiPath Assets Guide](https://docs.uipath.com/orchestrator/automation-cloud/latest/user-guide/about-assets)
|
|
1803
|
+
*/
|
|
1804
|
+
interface AssetServiceModel {
|
|
1805
|
+
/**
|
|
1806
|
+
* Gets all assets across folders with optional filtering
|
|
1807
|
+
*
|
|
1808
|
+
* @param options Query options including optional folderId and pagination options
|
|
1809
|
+
* @returns Promise resolving to either an array of assets NonPaginatedResponse<AssetGetResponse> or a PaginatedResponse<AssetGetResponse> when pagination options are used.
|
|
1810
|
+
* {@link AssetGetResponse}
|
|
1811
|
+
* @example
|
|
1812
|
+
* ```typescript
|
|
1813
|
+
* // Standard array return
|
|
1814
|
+
* const assets = await sdk.assets.getAll();
|
|
1815
|
+
*
|
|
1816
|
+
* // With folder
|
|
1817
|
+
* const folderAssets = await sdk.assets.getAll({ folderId: <folderId> });
|
|
1818
|
+
*
|
|
1819
|
+
* // First page with pagination
|
|
1820
|
+
* const page1 = await sdk.assets.getAll({ pageSize: 10 });
|
|
1821
|
+
*
|
|
1822
|
+
* // Navigate using cursor
|
|
1823
|
+
* if (page1.hasNextPage) {
|
|
1824
|
+
* const page2 = await sdk.assets.getAll({ cursor: page1.nextCursor });
|
|
1825
|
+
* }
|
|
1826
|
+
*
|
|
1827
|
+
* // Jump to specific page
|
|
1828
|
+
* const page5 = await sdk.assets.getAll({
|
|
1829
|
+
* jumpToPage: 5,
|
|
1830
|
+
* pageSize: 10
|
|
1831
|
+
* });
|
|
1832
|
+
* ```
|
|
1833
|
+
*/
|
|
1834
|
+
getAll<T extends AssetGetAllOptions = AssetGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<AssetGetResponse> : NonPaginatedResponse<AssetGetResponse>>;
|
|
1835
|
+
/**
|
|
1836
|
+
* Gets a single asset by ID
|
|
1837
|
+
*
|
|
1838
|
+
* @param id - Asset ID
|
|
1839
|
+
* @param folderId - Required folder ID
|
|
1840
|
+
* @param options - Optional query parameters (expand, select)
|
|
1841
|
+
* @returns Promise resolving to a single asset
|
|
1842
|
+
* {@link AssetGetResponse}
|
|
1843
|
+
* @example
|
|
1844
|
+
* ```typescript
|
|
1845
|
+
* // Get asset by ID
|
|
1846
|
+
* const asset = await sdk.assets.getById(<assetId>, <folderId>);
|
|
1847
|
+
* ```
|
|
1848
|
+
*/
|
|
1849
|
+
getById(id: number, folderId: number, options?: AssetGetByIdOptions): Promise<AssetGetResponse>;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
/**
|
|
1853
|
+
* Service for interacting with UiPath Orchestrator Assets API
|
|
1854
|
+
*/
|
|
1855
|
+
declare class AssetService extends FolderScopedService implements AssetServiceModel {
|
|
1856
|
+
/**
|
|
1857
|
+
* @hideconstructor
|
|
1858
|
+
*/
|
|
1859
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager);
|
|
1860
|
+
/**
|
|
1861
|
+
* Gets all assets across folders with optional filtering and folder scoping
|
|
1862
|
+
*
|
|
1863
|
+
* @signature getAll(options?) -> Promise<AssetGetResponse[]>
|
|
1864
|
+
* @param options Query options including optional folderId and pagination options
|
|
1865
|
+
* @returns Promise resolving to array of assets or paginated response
|
|
1866
|
+
*
|
|
1867
|
+
* @example
|
|
1868
|
+
* ```typescript
|
|
1869
|
+
* // Standard array return
|
|
1870
|
+
* const assets = await sdk.assets.getAll();
|
|
1871
|
+
*
|
|
1872
|
+
* // With folder
|
|
1873
|
+
* const folderAssets = await sdk.assets.getAll({ folderId: 123 });
|
|
1874
|
+
*
|
|
1875
|
+
* // First page with pagination
|
|
1876
|
+
* const page1 = await sdk.assets.getAll({ pageSize: 10 });
|
|
1877
|
+
*
|
|
1878
|
+
* // Navigate using cursor
|
|
1879
|
+
* if (page1.hasNextPage) {
|
|
1880
|
+
* const page2 = await sdk.assets.getAll({ cursor: page1.nextCursor });
|
|
1881
|
+
* }
|
|
1882
|
+
*
|
|
1883
|
+
* // Jump to specific page
|
|
1884
|
+
* const page5 = await sdk.assets.getAll({
|
|
1885
|
+
* jumpToPage: 5,
|
|
1886
|
+
* pageSize: 10
|
|
1887
|
+
* });
|
|
1888
|
+
* ```
|
|
1889
|
+
*/
|
|
1890
|
+
getAll<T extends AssetGetAllOptions = AssetGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<AssetGetResponse> : NonPaginatedResponse<AssetGetResponse>>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Gets a single asset by ID
|
|
1893
|
+
*
|
|
1894
|
+
* @param id - Asset ID
|
|
1895
|
+
* @param folderId - Required folder ID
|
|
1896
|
+
* @param options - Optional query parameters (expand, select)
|
|
1897
|
+
* @returns Promise resolving to a single asset
|
|
1898
|
+
*
|
|
1899
|
+
* @example
|
|
1900
|
+
* ```typescript
|
|
1901
|
+
* // Get asset by ID
|
|
1902
|
+
* const asset = await sdk.assets.getById(123, 456);
|
|
1903
|
+
* ```
|
|
1904
|
+
*/
|
|
1905
|
+
getById(id: number, folderId: number, options?: AssetGetByIdOptions): Promise<AssetGetResponse>;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
declare enum BucketOptions {
|
|
1909
|
+
None = "None",
|
|
1910
|
+
ReadOnly = "ReadOnly",
|
|
1911
|
+
AuditReadAccess = "AuditReadAccess",
|
|
1912
|
+
AccessDataThroughOrchestrator = "AccessDataThroughOrchestrator"
|
|
1913
|
+
}
|
|
1914
|
+
interface BucketGetResponse {
|
|
1915
|
+
id: number;
|
|
1916
|
+
name: string;
|
|
1917
|
+
description: string | null;
|
|
1918
|
+
identifier: string;
|
|
1919
|
+
storageProvider: string | null;
|
|
1920
|
+
storageParameters: string | null;
|
|
1921
|
+
storageContainer: string | null;
|
|
1922
|
+
options: BucketOptions;
|
|
1923
|
+
credentialStoreId: number | null;
|
|
1924
|
+
externalName: string | null;
|
|
1925
|
+
password: string | null;
|
|
1926
|
+
foldersCount: number;
|
|
1927
|
+
}
|
|
1928
|
+
type BucketGetAllOptions = RequestOptions & PaginationOptions & {
|
|
1929
|
+
folderId?: number;
|
|
1930
|
+
};
|
|
1931
|
+
type BucketGetByIdOptions = BaseOptions;
|
|
1932
|
+
/**
|
|
1933
|
+
* Maps header names to their values
|
|
1934
|
+
*
|
|
1935
|
+
* @example
|
|
1936
|
+
* ```typescript
|
|
1937
|
+
* {
|
|
1938
|
+
* "x-ms-blob-type": "BlockBlob"
|
|
1939
|
+
* }
|
|
1940
|
+
* ```
|
|
1941
|
+
*/
|
|
1942
|
+
type ResponseDictionary = Record<string, string>;
|
|
1943
|
+
/**
|
|
1944
|
+
* Response from the GetReadUri API
|
|
1945
|
+
*/
|
|
1946
|
+
interface BucketGetUriResponse {
|
|
1947
|
+
/**
|
|
1948
|
+
* The URI for accessing the blob file
|
|
1949
|
+
*/
|
|
1950
|
+
uri: string;
|
|
1951
|
+
/**
|
|
1952
|
+
* HTTP method to use with the URI
|
|
1953
|
+
*/
|
|
1954
|
+
httpMethod: string;
|
|
1955
|
+
/**
|
|
1956
|
+
* Whether authentication is required to access the URI
|
|
1957
|
+
*/
|
|
1958
|
+
requiresAuth: boolean;
|
|
1959
|
+
/**
|
|
1960
|
+
* Headers to be included in the request
|
|
1961
|
+
*/
|
|
1962
|
+
headers: ResponseDictionary;
|
|
1963
|
+
}
|
|
1964
|
+
interface BucketGetUriOptions extends BaseOptions {
|
|
1965
|
+
/**
|
|
1966
|
+
* The ID of the bucket
|
|
1967
|
+
*/
|
|
1968
|
+
bucketId: number;
|
|
1969
|
+
/**
|
|
1970
|
+
* The ID of the folder
|
|
1971
|
+
*/
|
|
1972
|
+
folderId: number;
|
|
1973
|
+
/**
|
|
1974
|
+
* The full path to the BlobFile
|
|
1975
|
+
*/
|
|
1976
|
+
path: string;
|
|
1977
|
+
/**
|
|
1978
|
+
* URL expiration time in minutes (0 for default)
|
|
1979
|
+
*/
|
|
1980
|
+
expiryInMinutes?: number;
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* Request options for getting a read URI for a file in a bucket
|
|
1984
|
+
*/
|
|
1985
|
+
type BucketGetReadUriOptions = BucketGetUriOptions;
|
|
1986
|
+
/**
|
|
1987
|
+
* Request options for getting a write URI for a file in a bucket
|
|
1988
|
+
*/
|
|
1989
|
+
interface BucketGetWriteUriOptions extends BucketGetUriOptions {
|
|
1990
|
+
/**
|
|
1991
|
+
* ContentType for S3 access policy
|
|
1992
|
+
*/
|
|
1993
|
+
contentType?: string;
|
|
1994
|
+
}
|
|
1995
|
+
/**
|
|
1996
|
+
* Request options for getting files in a bucket
|
|
1997
|
+
*/
|
|
1998
|
+
interface BucketGetFileMetaDataOptions {
|
|
1999
|
+
/**
|
|
2000
|
+
* The path prefix to filter files by
|
|
2001
|
+
*/
|
|
2002
|
+
prefix?: string;
|
|
2003
|
+
}
|
|
2004
|
+
/**
|
|
2005
|
+
* Request options for getting files in a bucket with pagination support
|
|
2006
|
+
*/
|
|
2007
|
+
type BucketGetFileMetaDataWithPaginationOptions = BucketGetFileMetaDataOptions & PaginationOptions;
|
|
2008
|
+
/**
|
|
2009
|
+
* Response from the GetFiles API
|
|
2010
|
+
*/
|
|
2011
|
+
interface BucketGetFileMetaDataResponse {
|
|
2012
|
+
/**
|
|
2013
|
+
* Array of blob items in the bucket
|
|
2014
|
+
*/
|
|
2015
|
+
blobItems: BlobItem[];
|
|
2016
|
+
/**
|
|
2017
|
+
* Token for retrieving the next set of results
|
|
2018
|
+
*/
|
|
2019
|
+
continuationToken: string | null;
|
|
2020
|
+
}
|
|
2021
|
+
/**
|
|
2022
|
+
* Represents a file or blob in a bucket
|
|
2023
|
+
*/
|
|
2024
|
+
interface BlobItem {
|
|
2025
|
+
/**
|
|
2026
|
+
* Full path to the blob
|
|
2027
|
+
*/
|
|
2028
|
+
path: string;
|
|
2029
|
+
/**
|
|
2030
|
+
* Content type of the blob
|
|
2031
|
+
*/
|
|
2032
|
+
contentType: string;
|
|
2033
|
+
/**
|
|
2034
|
+
* Size of the blob in bytes
|
|
2035
|
+
*/
|
|
2036
|
+
size: number;
|
|
2037
|
+
/**
|
|
2038
|
+
* Last modified timestamp
|
|
2039
|
+
*/
|
|
2040
|
+
lastModified: string | null;
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Options for uploading files to a bucket
|
|
2044
|
+
*/
|
|
2045
|
+
interface BucketUploadFileOptions {
|
|
2046
|
+
/**
|
|
2047
|
+
* The ID of the bucket to upload to
|
|
2048
|
+
*/
|
|
2049
|
+
bucketId: number;
|
|
2050
|
+
/**
|
|
2051
|
+
* The folder/organization unit ID for context
|
|
2052
|
+
*/
|
|
2053
|
+
folderId: number;
|
|
2054
|
+
/**
|
|
2055
|
+
* Path where the file should be stored in the bucket
|
|
2056
|
+
*/
|
|
2057
|
+
path: string;
|
|
2058
|
+
/**
|
|
2059
|
+
* File content to upload
|
|
2060
|
+
*/
|
|
2061
|
+
content: Blob | Buffer | File;
|
|
2062
|
+
/**
|
|
2063
|
+
* Optional MIME type of the file
|
|
2064
|
+
* If not provided, it will be auto-detected
|
|
2065
|
+
*/
|
|
2066
|
+
contentType?: string;
|
|
2067
|
+
}
|
|
2068
|
+
/**
|
|
2069
|
+
* Response from file upload operations
|
|
2070
|
+
*/
|
|
2071
|
+
interface BucketUploadResponse {
|
|
2072
|
+
/**
|
|
2073
|
+
* Whether the upload was successful
|
|
2074
|
+
*/
|
|
2075
|
+
success: boolean;
|
|
2076
|
+
/**
|
|
2077
|
+
* HTTP status code from the upload operation
|
|
2078
|
+
*/
|
|
2079
|
+
statusCode: number;
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
/**
|
|
2083
|
+
* Service for managing UiPath storage Buckets.
|
|
2084
|
+
*
|
|
2085
|
+
* Buckets are cloud storage containers that can be used to store and manage files used by automation processes. [UiPath Buckets Guide](https://docs.uipath.com/orchestrator/automation-cloud/latest/user-guide/about-storage-buckets)
|
|
2086
|
+
*/
|
|
2087
|
+
interface BucketServiceModel {
|
|
2088
|
+
/**
|
|
2089
|
+
* Gets all buckets across folders with optional filtering
|
|
2090
|
+
*
|
|
2091
|
+
* The method returns either:
|
|
2092
|
+
* - A NonPaginatedResponse with data and totalCount (when no pagination parameters are provided)
|
|
2093
|
+
* - A paginated result with navigation cursors (when any pagination parameter is provided)
|
|
2094
|
+
*
|
|
2095
|
+
* @param options - Query options including optional folderId and pagination options
|
|
2096
|
+
* @returns Promise resolving to either an array of buckets NonPaginatedResponse<BucketGetResponse> or a PaginatedResponse<BucketGetResponse> when pagination options are used.
|
|
2097
|
+
* {@link BucketGetResponse}
|
|
2098
|
+
* @example
|
|
2099
|
+
* ```typescript
|
|
2100
|
+
* // Get all buckets across folders
|
|
2101
|
+
* const buckets = await sdk.buckets.getAll();
|
|
2102
|
+
*
|
|
2103
|
+
* // Get buckets within a specific folder
|
|
2104
|
+
* const buckets = await sdk.buckets.getAll({
|
|
2105
|
+
* folderId: <folderId>
|
|
2106
|
+
* });
|
|
2107
|
+
*
|
|
2108
|
+
* // Get buckets with filtering
|
|
2109
|
+
* const buckets = await sdk.buckets.getAll({
|
|
2110
|
+
* filter: "name eq 'MyBucket'"
|
|
2111
|
+
* });
|
|
2112
|
+
*
|
|
2113
|
+
* // First page with pagination
|
|
2114
|
+
* const page1 = await sdk.buckets.getAll({ pageSize: 10 });
|
|
2115
|
+
*
|
|
2116
|
+
* // Navigate using cursor
|
|
2117
|
+
* if (page1.hasNextPage) {
|
|
2118
|
+
* const page2 = await sdk.buckets.getAll({ cursor: page1.nextCursor });
|
|
2119
|
+
* }
|
|
2120
|
+
*
|
|
2121
|
+
* // Jump to specific page
|
|
2122
|
+
* const page5 = await sdk.buckets.getAll({
|
|
2123
|
+
* jumpToPage: 5,
|
|
2124
|
+
* pageSize: 10
|
|
2125
|
+
* });
|
|
2126
|
+
* ```
|
|
2127
|
+
*/
|
|
2128
|
+
getAll<T extends BucketGetAllOptions = BucketGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<BucketGetResponse> : NonPaginatedResponse<BucketGetResponse>>;
|
|
2129
|
+
/**
|
|
2130
|
+
* Gets a single bucket by ID
|
|
2131
|
+
*
|
|
2132
|
+
* @param bucketId - Bucket ID
|
|
2133
|
+
* @param folderId - Required folder ID
|
|
2134
|
+
* @param options - Optional query parameters
|
|
2135
|
+
* @returns Promise resolving to a bucket definition
|
|
2136
|
+
* {@link BucketGetResponse}
|
|
2137
|
+
* @example
|
|
2138
|
+
* ```typescript
|
|
2139
|
+
* // Get bucket by ID
|
|
2140
|
+
* const bucket = await sdk.buckets.getById(<bucketId>, <folderId>);
|
|
2141
|
+
* ```
|
|
2142
|
+
*/
|
|
2143
|
+
getById(bucketId: number, folderId: number, options?: BucketGetByIdOptions): Promise<BucketGetResponse>;
|
|
2144
|
+
/**
|
|
2145
|
+
* Gets metadata for files in a bucket with optional filtering and pagination
|
|
2146
|
+
*
|
|
2147
|
+
* The method returns either:
|
|
2148
|
+
* - A NonPaginatedResponse with items array (when no pagination parameters are provided)
|
|
2149
|
+
* - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
|
|
2150
|
+
*
|
|
2151
|
+
* @param bucketId - The ID of the bucket to get file metadata from
|
|
2152
|
+
* @param folderId - Required folder ID for organization unit context
|
|
2153
|
+
* @param options - Optional parameters for filtering, pagination and access URL generation
|
|
2154
|
+
* @returns Promise resolving to either an array of files metadata NonPaginatedResponse<BlobItem> or a PaginatedResponse<BlobItem> when pagination options are used.
|
|
2155
|
+
* {@link BlobItem}
|
|
2156
|
+
* @example
|
|
2157
|
+
* ```typescript
|
|
2158
|
+
* // Get metadata for all files in a bucket
|
|
2159
|
+
* const fileMetadata = await sdk.buckets.getFileMetaData(<bucketId>, <folderId>);
|
|
2160
|
+
*
|
|
2161
|
+
* // Get file metadata with a specific prefix
|
|
2162
|
+
* const fileMetadata = await sdk.buckets.getFileMetaData(<bucketId>, <folderId>, {
|
|
2163
|
+
* prefix: '/folder1'
|
|
2164
|
+
* });
|
|
2165
|
+
*
|
|
2166
|
+
* // First page with pagination
|
|
2167
|
+
* const page1 = await sdk.buckets.getFileMetaData(<bucketId>, <folderId>, { pageSize: 10 });
|
|
2168
|
+
*
|
|
2169
|
+
* // Navigate using cursor
|
|
2170
|
+
* if (page1.hasNextPage) {
|
|
2171
|
+
* const page2 = await sdk.buckets.getFileMetaData(<bucketId>, <folderId>, { cursor: page1.nextCursor });
|
|
2172
|
+
* }
|
|
2173
|
+
* ```
|
|
2174
|
+
*/
|
|
2175
|
+
getFileMetaData<T extends BucketGetFileMetaDataWithPaginationOptions = BucketGetFileMetaDataWithPaginationOptions>(bucketId: number, folderId: number, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<BlobItem> : NonPaginatedResponse<BlobItem>>;
|
|
2176
|
+
/**
|
|
2177
|
+
* Gets a direct download URL for a file in the bucket
|
|
2178
|
+
*
|
|
2179
|
+
* @param options - Contains bucketId, folderId, file path and optional expiry time
|
|
2180
|
+
* @returns Promise resolving to blob file access information
|
|
2181
|
+
* {@link BucketGetUriResponse}
|
|
2182
|
+
* @example
|
|
2183
|
+
* ```typescript
|
|
2184
|
+
* // Get download URL for a file
|
|
2185
|
+
* const fileAccess = await sdk.buckets.getReadUri({
|
|
2186
|
+
* bucketId: <bucketId>,
|
|
2187
|
+
* folderId: <folderId>,
|
|
2188
|
+
* path: '/folder/file.pdf'
|
|
2189
|
+
* });
|
|
2190
|
+
* ```
|
|
2191
|
+
*/
|
|
2192
|
+
getReadUri(options: BucketGetReadUriOptions): Promise<BucketGetUriResponse>;
|
|
2193
|
+
/**
|
|
2194
|
+
* Uploads a file to a bucket
|
|
2195
|
+
*
|
|
2196
|
+
* @param options - Options for file upload including bucket ID, folder ID, path, content, and optional parameters
|
|
2197
|
+
* @returns Promise resolving bucket upload response
|
|
2198
|
+
* {@link BucketUploadResponse}
|
|
2199
|
+
* @example
|
|
2200
|
+
* ```typescript
|
|
2201
|
+
* // Upload a file from browser
|
|
2202
|
+
* const file = new File(['file content'], 'example.txt');
|
|
2203
|
+
* const result = await sdk.buckets.uploadFile({
|
|
2204
|
+
* bucketId: <bucketId>,
|
|
2205
|
+
* folderId: <folderId>,
|
|
2206
|
+
* path: '/folder/example.txt',
|
|
2207
|
+
* content: file
|
|
2208
|
+
* });
|
|
2209
|
+
*
|
|
2210
|
+
* // In Node env with explicit content type
|
|
2211
|
+
* const buffer = Buffer.from('file content');
|
|
2212
|
+
* const result = await sdk.buckets.uploadFile({
|
|
2213
|
+
* bucketId: <bucketId>,
|
|
2214
|
+
* folderId: <folderId>,
|
|
2215
|
+
* path: '/folder/example.txt',
|
|
2216
|
+
* content: buffer,
|
|
2217
|
+
* contentType: 'text/plain'
|
|
2218
|
+
* });
|
|
2219
|
+
* ```
|
|
2220
|
+
*/
|
|
2221
|
+
uploadFile(options: BucketUploadFileOptions): Promise<BucketUploadResponse>;
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
declare class BucketService extends FolderScopedService implements BucketServiceModel {
|
|
2225
|
+
protected readonly tokenManager: TokenManager;
|
|
2226
|
+
/**
|
|
2227
|
+
* @hideconstructor
|
|
2228
|
+
*/
|
|
2229
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager);
|
|
2230
|
+
/**
|
|
2231
|
+
* Gets a bucket by ID
|
|
2232
|
+
* @param bucketId - The ID of the bucket to retrieve
|
|
2233
|
+
* @param folderId - Folder ID for organization unit context
|
|
2234
|
+
* @param options - Optional query parameters (expand, select)
|
|
2235
|
+
* @returns Promise resolving to the bucket
|
|
2236
|
+
*
|
|
2237
|
+
* @example
|
|
2238
|
+
* ```typescript
|
|
2239
|
+
* // Get bucket by ID
|
|
2240
|
+
* const bucket = await sdk.buckets.getById(123, 456);
|
|
2241
|
+
* ```
|
|
2242
|
+
*/
|
|
2243
|
+
getById(id: number, folderId: number, options?: BucketGetByIdOptions): Promise<BucketGetResponse>;
|
|
2244
|
+
/**
|
|
2245
|
+
* Gets all buckets across folders with optional filtering and folder scoping
|
|
2246
|
+
*
|
|
2247
|
+
* The method returns either:
|
|
2248
|
+
* - An array of buckets (when no pagination parameters are provided)
|
|
2249
|
+
* - A paginated result with navigation cursors (when any pagination parameter is provided)
|
|
2250
|
+
*
|
|
2251
|
+
* @param options - Query options including optional folderId
|
|
2252
|
+
* @returns Promise resolving to an array of buckets or paginated result
|
|
2253
|
+
*
|
|
2254
|
+
* @example
|
|
2255
|
+
* ```typescript
|
|
2256
|
+
* // Get all buckets across folders
|
|
2257
|
+
* const buckets = await sdk.buckets.getAll();
|
|
2258
|
+
*
|
|
2259
|
+
* // Get buckets within a specific folder
|
|
2260
|
+
* const buckets = await sdk.buckets.getAll({
|
|
2261
|
+
* folderId: 123
|
|
2262
|
+
* });
|
|
2263
|
+
*
|
|
2264
|
+
* // Get buckets with filtering
|
|
2265
|
+
* const buckets = await sdk.buckets.getAll({
|
|
2266
|
+
* filter: "name eq 'MyBucket'"
|
|
2267
|
+
* });
|
|
2268
|
+
*
|
|
2269
|
+
* // First page with pagination
|
|
2270
|
+
* const page1 = await sdk.buckets.getAll({ pageSize: 10 });
|
|
2271
|
+
*
|
|
2272
|
+
* // Navigate using cursor
|
|
2273
|
+
* if (page1.hasNextPage) {
|
|
2274
|
+
* const page2 = await sdk.buckets.getAll({ cursor: page1.nextCursor });
|
|
2275
|
+
* }
|
|
2276
|
+
*
|
|
2277
|
+
* // Jump to specific page
|
|
2278
|
+
* const page5 = await sdk.buckets.getAll({
|
|
2279
|
+
* jumpToPage: 5,
|
|
2280
|
+
* pageSize: 10
|
|
2281
|
+
* });
|
|
2282
|
+
* ```
|
|
2283
|
+
*/
|
|
2284
|
+
getAll<T extends BucketGetAllOptions = BucketGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<BucketGetResponse> : NonPaginatedResponse<BucketGetResponse>>;
|
|
2285
|
+
/**
|
|
2286
|
+
* Gets metadata for files in a bucket with optional filtering and pagination
|
|
2287
|
+
*
|
|
2288
|
+
* The method returns either:
|
|
2289
|
+
* - A NonPaginatedResponse with items array (when no pagination parameters are provided)
|
|
2290
|
+
* - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
|
|
2291
|
+
*
|
|
2292
|
+
* @param bucketId - The ID of the bucket to get file metadata from
|
|
2293
|
+
* @param folderId - Required folder ID for organization unit context
|
|
2294
|
+
* @param options - Optional parameters for filtering, pagination and access URL generation
|
|
2295
|
+
* @returns Promise resolving to the list of file metadata in the bucket or paginated result
|
|
2296
|
+
*
|
|
2297
|
+
* @example
|
|
2298
|
+
* ```typescript
|
|
2299
|
+
* // Get metadata for all files in a bucket
|
|
2300
|
+
* const fileMetadata = await sdk.buckets.getFileMetaData(123, 456);
|
|
2301
|
+
*
|
|
2302
|
+
* // Get file metadata with a specific prefix
|
|
2303
|
+
* const fileMetadata = await sdk.buckets.getFileMetaData(123, 456, {
|
|
2304
|
+
* prefix: '/folder1'
|
|
2305
|
+
* });
|
|
2306
|
+
*
|
|
2307
|
+
* // First page with pagination
|
|
2308
|
+
* const page1 = await sdk.buckets.getFileMetaData(123, 456, { pageSize: 10 });
|
|
2309
|
+
*
|
|
2310
|
+
* // Navigate using cursor
|
|
2311
|
+
* if (page1.hasNextPage) {
|
|
2312
|
+
* const page2 = await sdk.buckets.getFileMetaData(123, 456, { cursor: page1.nextCursor });
|
|
2313
|
+
* }
|
|
2314
|
+
* ```
|
|
2315
|
+
*/
|
|
2316
|
+
getFileMetaData<T extends BucketGetFileMetaDataWithPaginationOptions = BucketGetFileMetaDataWithPaginationOptions>(bucketId: number, folderId: number, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<BlobItem> : NonPaginatedResponse<BlobItem>>;
|
|
2317
|
+
/**
|
|
2318
|
+
* Uploads a file to a bucket
|
|
2319
|
+
*
|
|
2320
|
+
* @param options - Options for file upload including bucket ID, folder ID, path, content, and optional parameters
|
|
2321
|
+
* @returns Promise resolving to a response with success status and HTTP status code
|
|
2322
|
+
*
|
|
2323
|
+
* @example
|
|
2324
|
+
* ```typescript
|
|
2325
|
+
* // Upload a file from browser
|
|
2326
|
+
* const file = new File(['file content'], 'example.txt');
|
|
2327
|
+
* const result = await sdk.buckets.uploadFile({
|
|
2328
|
+
* bucketId: 123,
|
|
2329
|
+
* folderId: 456,
|
|
2330
|
+
* path: '/folder/example.txt',
|
|
2331
|
+
* content: file
|
|
2332
|
+
* });
|
|
2333
|
+
*
|
|
2334
|
+
* // In Node env with explicit content type
|
|
2335
|
+
* const buffer = Buffer.from('file content');
|
|
2336
|
+
* const result = await sdk.buckets.uploadFile({
|
|
2337
|
+
* bucketId: 123,
|
|
2338
|
+
* folderId: 456,
|
|
2339
|
+
* path: '/folder/example.txt',
|
|
2340
|
+
* content: buffer,
|
|
2341
|
+
* contentType: 'text/plain'
|
|
2342
|
+
* });
|
|
2343
|
+
* ```
|
|
2344
|
+
*/
|
|
2345
|
+
uploadFile(options: BucketUploadFileOptions): Promise<BucketUploadResponse>;
|
|
2346
|
+
/**
|
|
2347
|
+
* Determines the content type of the file based on the content and path
|
|
2348
|
+
* Uses a hybrid approach:
|
|
2349
|
+
* 1. Checks Blob/File type if available (browser)
|
|
2350
|
+
* 2. Uses content-based detection with file-type (primarily Node.js)
|
|
2351
|
+
* 3. Falls back to extension-based detection with mime-types
|
|
2352
|
+
* 4. Finally defaults to application/octet-stream
|
|
2353
|
+
*
|
|
2354
|
+
* @param content - The file content
|
|
2355
|
+
* @param path - The file path
|
|
2356
|
+
* @returns The determined content type or default
|
|
2357
|
+
*/
|
|
2358
|
+
private _determineContentType;
|
|
2359
|
+
/**
|
|
2360
|
+
* Uploads content to the provided URI
|
|
2361
|
+
* @param uriResponse - Response from getWriteUri containing URL and headers
|
|
2362
|
+
* @param content - The content to upload
|
|
2363
|
+
* @param contentType - The content type of the file
|
|
2364
|
+
* @returns The response from the upload request with status info
|
|
2365
|
+
*/
|
|
2366
|
+
private _uploadToUri;
|
|
2367
|
+
/**
|
|
2368
|
+
* Private method to handle common URI request logic
|
|
2369
|
+
* @param endpoint - The API endpoint to call
|
|
2370
|
+
* @param bucketId - The bucket ID
|
|
2371
|
+
* @param folderId - The folder ID
|
|
2372
|
+
* @param path - The file path
|
|
2373
|
+
* @param queryOptions - Additional query parameters
|
|
2374
|
+
* @returns Promise resolving to blob file access information
|
|
2375
|
+
*/
|
|
2376
|
+
private _getUri;
|
|
2377
|
+
/**
|
|
2378
|
+
* Gets a direct download URL for a file in the bucket
|
|
2379
|
+
*
|
|
2380
|
+
* @param options - Contains bucketId, folderId, file path and optional expiry time
|
|
2381
|
+
* @returns Promise resolving to blob file access information
|
|
2382
|
+
*
|
|
2383
|
+
* @example
|
|
2384
|
+
* ```typescript
|
|
2385
|
+
* // Get download URL for a file
|
|
2386
|
+
* const fileAccess = await sdk.buckets.getReadUri({
|
|
2387
|
+
* bucketId: 123,
|
|
2388
|
+
* folderId: 456,
|
|
2389
|
+
* path: '/folder/file.pdf'
|
|
2390
|
+
* });
|
|
2391
|
+
* ```
|
|
2392
|
+
*/
|
|
2393
|
+
getReadUri(options: BucketGetReadUriOptions): Promise<BucketGetUriResponse>;
|
|
2394
|
+
/**
|
|
2395
|
+
* Gets a direct upload URL for a file in the bucket
|
|
2396
|
+
*
|
|
2397
|
+
* @param options - Contains bucketId, folderId, file path, optional expiry time and content type
|
|
2398
|
+
* @returns Promise resolving to blob file access information
|
|
2399
|
+
*/
|
|
2400
|
+
private _getWriteUri;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
/**
|
|
2404
|
+
* Enum for package types
|
|
2405
|
+
*/
|
|
2406
|
+
declare enum PackageType {
|
|
2407
|
+
Undefined = "Undefined",
|
|
2408
|
+
Process = "Process",
|
|
2409
|
+
ProcessOrchestration = "ProcessOrchestration",
|
|
2410
|
+
WebApp = "WebApp",
|
|
2411
|
+
Agent = "Agent",
|
|
2412
|
+
TestAutomationProcess = "TestAutomationProcess",
|
|
2413
|
+
Api = "Api",
|
|
2414
|
+
MCPServer = "MCPServer",
|
|
2415
|
+
BusinessRules = "BusinessRules"
|
|
2416
|
+
}
|
|
2417
|
+
/**
|
|
2418
|
+
* Enum for job priority
|
|
2419
|
+
*/
|
|
2420
|
+
declare enum JobPriority {
|
|
2421
|
+
Low = "Low",
|
|
2422
|
+
Normal = "Normal",
|
|
2423
|
+
High = "High"
|
|
2424
|
+
}
|
|
2425
|
+
/**
|
|
2426
|
+
* Enum for target framework
|
|
2427
|
+
*/
|
|
2428
|
+
declare enum TargetFramework {
|
|
2429
|
+
Legacy = "Legacy",
|
|
2430
|
+
Windows = "Windows",
|
|
2431
|
+
Portable = "Portable"
|
|
2432
|
+
}
|
|
2433
|
+
/**
|
|
2434
|
+
* Enum for robot size
|
|
2435
|
+
*/
|
|
2436
|
+
declare enum RobotSize {
|
|
2437
|
+
Small = "Small",
|
|
2438
|
+
Standard = "Standard",
|
|
2439
|
+
Medium = "Medium",
|
|
2440
|
+
Large = "Large"
|
|
2441
|
+
}
|
|
2442
|
+
/**
|
|
2443
|
+
* Enum for remote control access
|
|
2444
|
+
*/
|
|
2445
|
+
declare enum RemoteControlAccess {
|
|
2446
|
+
None = "None",
|
|
2447
|
+
ReadOnly = "ReadOnly",
|
|
2448
|
+
Full = "Full"
|
|
2449
|
+
}
|
|
2450
|
+
/**
|
|
2451
|
+
* Enum for process start strategy
|
|
2452
|
+
*/
|
|
2453
|
+
declare enum StartStrategy {
|
|
2454
|
+
All = "All",
|
|
2455
|
+
Specific = "Specific",
|
|
2456
|
+
RobotCount = "RobotCount",
|
|
2457
|
+
JobsCount = "JobsCount",
|
|
2458
|
+
ModernJobsCount = "ModernJobsCount"
|
|
2459
|
+
}
|
|
2460
|
+
/**
|
|
2461
|
+
* Enum for package source type
|
|
2462
|
+
*/
|
|
2463
|
+
declare enum PackageSourceType {
|
|
2464
|
+
Manual = "Manual",
|
|
2465
|
+
Schedule = "Schedule",
|
|
2466
|
+
Queue = "Queue",
|
|
2467
|
+
StudioWeb = "StudioWeb",
|
|
2468
|
+
IntegrationTrigger = "IntegrationTrigger",
|
|
2469
|
+
StudioDesktop = "StudioDesktop",
|
|
2470
|
+
AutomationOpsPipelines = "AutomationOpsPipelines",
|
|
2471
|
+
Apps = "Apps",
|
|
2472
|
+
SAP = "SAP",
|
|
2473
|
+
HttpTrigger = "HttpTrigger",
|
|
2474
|
+
HttpTriggerWithCallback = "HttpTriggerWithCallback",
|
|
2475
|
+
RobotAPI = "RobotAPI",
|
|
2476
|
+
Assistant = "Assistant",
|
|
2477
|
+
CommandLine = "CommandLine",
|
|
2478
|
+
RobotNetAPI = "RobotNetAPI",
|
|
2479
|
+
Autopilot = "Autopilot",
|
|
2480
|
+
TestManager = "TestManager",
|
|
2481
|
+
AgentService = "AgentService",
|
|
2482
|
+
ProcessOrchestration = "ProcessOrchestration",
|
|
2483
|
+
PluginEcosystem = "PluginEcosystem",
|
|
2484
|
+
PerformanceTesting = "PerformanceTesting",
|
|
2485
|
+
AgentHub = "AgentHub",
|
|
2486
|
+
ApiWorkflow = "ApiWorkflow"
|
|
2487
|
+
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Enum for stop strategy
|
|
2490
|
+
*/
|
|
2491
|
+
declare enum StopStrategy {
|
|
2492
|
+
SoftStop = "SoftStop",
|
|
2493
|
+
Kill = "Kill"
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Interface for Job Attachment
|
|
2497
|
+
*/
|
|
2498
|
+
interface JobAttachment {
|
|
2499
|
+
attachmentId: string;
|
|
2500
|
+
jobKey?: string;
|
|
2501
|
+
category?: string;
|
|
2502
|
+
attachmentName?: string;
|
|
2503
|
+
}
|
|
2504
|
+
/**
|
|
2505
|
+
* Interface for common process properties shared across multiple interfaces
|
|
2506
|
+
*/
|
|
2507
|
+
interface ProcessProperties {
|
|
2508
|
+
jobPriority?: JobPriority;
|
|
2509
|
+
specificPriorityValue?: number;
|
|
2510
|
+
inputArguments?: string;
|
|
2511
|
+
environmentVariables?: string;
|
|
2512
|
+
entryPointPath?: string;
|
|
2513
|
+
remoteControlAccess?: RemoteControlAccess;
|
|
2514
|
+
requiresUserInteraction?: boolean;
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Interface for common folder properties
|
|
2518
|
+
*/
|
|
2519
|
+
interface FolderProperties {
|
|
2520
|
+
folderId?: number;
|
|
2521
|
+
folderName?: string;
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* Base interface for process start request
|
|
2525
|
+
*/
|
|
2526
|
+
interface BaseProcessStartRequest extends ProcessProperties {
|
|
2527
|
+
strategy?: StartStrategy;
|
|
2528
|
+
robotIds?: number[];
|
|
2529
|
+
machineSessionIds?: number[];
|
|
2530
|
+
noOfRobots?: number;
|
|
2531
|
+
jobsCount?: number;
|
|
2532
|
+
source?: PackageSourceType;
|
|
2533
|
+
runtimeType?: string;
|
|
2534
|
+
inputFile?: string;
|
|
2535
|
+
reference?: string;
|
|
2536
|
+
attachments?: JobAttachment[];
|
|
2537
|
+
targetFramework?: TargetFramework;
|
|
2538
|
+
resumeOnSameContext?: boolean;
|
|
2539
|
+
batchExecutionKey?: string;
|
|
2540
|
+
stopProcessExpression?: string;
|
|
2541
|
+
stopStrategy?: StopStrategy;
|
|
2542
|
+
killProcessExpression?: string;
|
|
2543
|
+
alertPendingExpression?: string;
|
|
2544
|
+
alertRunningExpression?: string;
|
|
2545
|
+
runAsMe?: boolean;
|
|
2546
|
+
parentOperationId?: string;
|
|
2547
|
+
}
|
|
2548
|
+
/**
|
|
2549
|
+
* Interface for start process request with processKey
|
|
2550
|
+
*/
|
|
2551
|
+
interface ProcessStartRequestWithKey extends BaseProcessStartRequest {
|
|
2552
|
+
processKey: string;
|
|
2553
|
+
processName?: string;
|
|
2554
|
+
}
|
|
2555
|
+
/**
|
|
2556
|
+
* Interface for start process request with processName
|
|
2557
|
+
*/
|
|
2558
|
+
interface ProcessStartRequestWithName extends BaseProcessStartRequest {
|
|
2559
|
+
processKey?: string;
|
|
2560
|
+
processName: string;
|
|
2561
|
+
}
|
|
2562
|
+
/**
|
|
2563
|
+
* Interface for start process request
|
|
2564
|
+
* Either processKey or processName must be provided
|
|
2565
|
+
*/
|
|
2566
|
+
type ProcessStartRequest = ProcessStartRequestWithKey | ProcessStartRequestWithName;
|
|
2567
|
+
/**
|
|
2568
|
+
* Interface for robot metadata
|
|
2569
|
+
*/
|
|
2570
|
+
interface RobotMetadata {
|
|
2571
|
+
id: number;
|
|
2572
|
+
name?: string;
|
|
2573
|
+
username?: string;
|
|
2574
|
+
}
|
|
2575
|
+
/**
|
|
2576
|
+
* Interface for machine
|
|
2577
|
+
*/
|
|
2578
|
+
interface Machine {
|
|
2579
|
+
id: number;
|
|
2580
|
+
name?: string;
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Interface for job error
|
|
2584
|
+
*/
|
|
2585
|
+
interface JobError {
|
|
2586
|
+
code?: string;
|
|
2587
|
+
title?: string;
|
|
2588
|
+
detail?: string;
|
|
2589
|
+
category?: string;
|
|
2590
|
+
status?: number;
|
|
2591
|
+
timestamp?: string;
|
|
2592
|
+
}
|
|
2593
|
+
/**
|
|
2594
|
+
* Enum for job type
|
|
2595
|
+
*/
|
|
2596
|
+
declare enum JobType {
|
|
2597
|
+
Unattended = "Unattended",
|
|
2598
|
+
Attended = "Attended",
|
|
2599
|
+
ServerlessGeneric = "ServerlessGeneric"
|
|
2600
|
+
}
|
|
2601
|
+
/**
|
|
2602
|
+
* Interface for argument metadata
|
|
2603
|
+
*/
|
|
2604
|
+
interface ArgumentMetadata {
|
|
2605
|
+
input?: string;
|
|
2606
|
+
output?: string;
|
|
2607
|
+
}
|
|
2608
|
+
/**
|
|
2609
|
+
* Interface for job response
|
|
2610
|
+
*/
|
|
2611
|
+
interface ProcessStartResponse extends ProcessProperties, FolderProperties {
|
|
2612
|
+
key: string;
|
|
2613
|
+
startTime: string | null;
|
|
2614
|
+
endTime: string | null;
|
|
2615
|
+
state: JobState;
|
|
2616
|
+
source: string;
|
|
2617
|
+
sourceType: string;
|
|
2618
|
+
batchExecutionKey: string;
|
|
2619
|
+
info: string | null;
|
|
2620
|
+
createdTime: string;
|
|
2621
|
+
startingScheduleId: number | null;
|
|
2622
|
+
processName: string;
|
|
2623
|
+
type: JobType;
|
|
2624
|
+
inputFile: string | null;
|
|
2625
|
+
outputArguments: string | null;
|
|
2626
|
+
outputFile: string | null;
|
|
2627
|
+
hostMachineName: string | null;
|
|
2628
|
+
persistenceId: string | null;
|
|
2629
|
+
resumeVersion: number | null;
|
|
2630
|
+
stopStrategy: StopStrategy | null;
|
|
2631
|
+
runtimeType: string;
|
|
2632
|
+
processVersionId: number | null;
|
|
2633
|
+
reference: string;
|
|
2634
|
+
packageType: PackageType;
|
|
2635
|
+
machine?: Machine;
|
|
2636
|
+
resumeOnSameContext: boolean;
|
|
2637
|
+
localSystemAccount: string;
|
|
2638
|
+
orchestratorUserIdentity: string | null;
|
|
2639
|
+
startingTriggerId: string | null;
|
|
2640
|
+
maxExpectedRunningTimeSeconds: number | null;
|
|
2641
|
+
parentJobKey: string | null;
|
|
2642
|
+
resumeTime: string | null;
|
|
2643
|
+
lastModifiedTime: string | null;
|
|
2644
|
+
jobError: JobError | null;
|
|
2645
|
+
errorCode: string | null;
|
|
2646
|
+
robot?: RobotMetadata;
|
|
2647
|
+
id: number;
|
|
2648
|
+
}
|
|
2649
|
+
/**
|
|
2650
|
+
* Interface for process response
|
|
2651
|
+
*/
|
|
2652
|
+
interface ProcessGetResponse extends ProcessProperties, FolderProperties {
|
|
2653
|
+
key: string;
|
|
2654
|
+
packageKey: string;
|
|
2655
|
+
packageVersion: string;
|
|
2656
|
+
isLatestVersion: boolean;
|
|
2657
|
+
isPackageDeleted: boolean;
|
|
2658
|
+
description: string;
|
|
2659
|
+
name: string;
|
|
2660
|
+
entryPointId: number;
|
|
2661
|
+
packageType: PackageType;
|
|
2662
|
+
supportsMultipleEntryPoints: boolean;
|
|
2663
|
+
isConversational: boolean | null;
|
|
2664
|
+
minRequiredRobotVersion: string | null;
|
|
2665
|
+
isCompiled: boolean;
|
|
2666
|
+
arguments: ArgumentMetadata;
|
|
2667
|
+
autoUpdate: boolean;
|
|
2668
|
+
hiddenForAttendedUser: boolean;
|
|
2669
|
+
feedId: string;
|
|
2670
|
+
folderKey: string;
|
|
2671
|
+
targetFramework: TargetFramework;
|
|
2672
|
+
robotSize: RobotSize | null;
|
|
2673
|
+
lastModifiedTime: string | null;
|
|
2674
|
+
lastModifierUserId: number | null;
|
|
2675
|
+
createdTime: string;
|
|
2676
|
+
creatorUserId: number;
|
|
2677
|
+
id: number;
|
|
2678
|
+
}
|
|
2679
|
+
/**
|
|
2680
|
+
* Options for getting processes across folders
|
|
2681
|
+
*/
|
|
2682
|
+
type ProcessGetAllOptions = RequestOptions & PaginationOptions & {
|
|
2683
|
+
/**
|
|
2684
|
+
* Optional folder ID to filter processes by folder
|
|
2685
|
+
*/
|
|
2686
|
+
folderId?: number;
|
|
2687
|
+
};
|
|
2688
|
+
/**
|
|
2689
|
+
* Options for getting a single process by ID
|
|
2690
|
+
*/
|
|
2691
|
+
type ProcessGetByIdOptions = BaseOptions;
|
|
2692
|
+
|
|
2693
|
+
/**
|
|
2694
|
+
* Service for managing and executing UiPath Automation Processes.
|
|
2695
|
+
*
|
|
2696
|
+
* Processes (also known as automations or workflows) are the core units of automation in UiPath, representing sequences of activities that perform specific business tasks. [UiPath Processes Guide](https://docs.uipath.com/orchestrator/automation-cloud/latest/user-guide/about-processes)
|
|
2697
|
+
*/
|
|
2698
|
+
interface ProcessServiceModel {
|
|
2699
|
+
/**
|
|
2700
|
+
* Gets all processes across folders with optional filtering
|
|
2701
|
+
* Returns a NonPaginatedResponse with data and totalCount when no pagination parameters are provided,
|
|
2702
|
+
* or a PaginatedResponse when any pagination parameter is provided
|
|
2703
|
+
*
|
|
2704
|
+
* @param options - Query options including optional folderId and pagination options
|
|
2705
|
+
* @returns Promise resolving to either an array of processes NonPaginatedResponse<ProcessGetResponse> or a PaginatedResponse<ProcessGetResponse> when pagination options are used.
|
|
2706
|
+
* {@link ProcessGetResponse}
|
|
2707
|
+
* @example
|
|
2708
|
+
* ```typescript
|
|
2709
|
+
* // Standard array return
|
|
2710
|
+
* const processes = await sdk.processes.getAll();
|
|
2711
|
+
*
|
|
2712
|
+
* // Get processes within a specific folder
|
|
2713
|
+
* const processes = await sdk.processes.getAll({
|
|
2714
|
+
* folderId: <folderId>
|
|
2715
|
+
* });
|
|
2716
|
+
*
|
|
2717
|
+
* // Get processes with filtering
|
|
2718
|
+
* const processes = await sdk.processes.getAll({
|
|
2719
|
+
* filter: "name eq 'MyProcess'"
|
|
2720
|
+
* });
|
|
2721
|
+
*
|
|
2722
|
+
* // First page with pagination
|
|
2723
|
+
* const page1 = await sdk.processes.getAll({ pageSize: 10 });
|
|
2724
|
+
*
|
|
2725
|
+
* // Navigate using cursor
|
|
2726
|
+
* if (page1.hasNextPage) {
|
|
2727
|
+
* const page2 = await sdk.processes.getAll({ cursor: page1.nextCursor });
|
|
2728
|
+
* }
|
|
2729
|
+
*
|
|
2730
|
+
* // Jump to specific page
|
|
2731
|
+
* const page5 = await sdk.processes.getAll({
|
|
2732
|
+
* jumpToPage: 5,
|
|
2733
|
+
* pageSize: 10
|
|
2734
|
+
* });
|
|
2735
|
+
* ```
|
|
2736
|
+
*/
|
|
2737
|
+
getAll<T extends ProcessGetAllOptions = ProcessGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ProcessGetResponse> : NonPaginatedResponse<ProcessGetResponse>>;
|
|
2738
|
+
/**
|
|
2739
|
+
* Gets a single process by ID
|
|
2740
|
+
*
|
|
2741
|
+
* @param id - Process ID
|
|
2742
|
+
* @param folderId - Required folder ID
|
|
2743
|
+
* @param options - Optional query parameters
|
|
2744
|
+
* @returns Promise resolving to a single process
|
|
2745
|
+
* {@link ProcessGetResponse}
|
|
2746
|
+
* @example
|
|
2747
|
+
* ```typescript
|
|
2748
|
+
* // Get process by ID
|
|
2749
|
+
* const process = await sdk.processes.getById(<processId>, <folderId>);
|
|
2750
|
+
* ```
|
|
2751
|
+
*/
|
|
2752
|
+
getById(id: number, folderId: number, options?: ProcessGetByIdOptions): Promise<ProcessGetResponse>;
|
|
2753
|
+
/**
|
|
2754
|
+
* Starts a process with the specified configuration
|
|
2755
|
+
*
|
|
2756
|
+
* @param request - Process start configuration
|
|
2757
|
+
* @param folderId - Required folder ID
|
|
2758
|
+
* @param options - Optional request options
|
|
2759
|
+
* @returns Promise resolving to array of started process instances
|
|
2760
|
+
* {@link ProcessStartResponse}
|
|
2761
|
+
* @example
|
|
2762
|
+
* ```typescript
|
|
2763
|
+
* // Start a process by process key
|
|
2764
|
+
* const process = await sdk.processes.start({
|
|
2765
|
+
* processKey: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
2766
|
+
* }, <folderId>); // folderId is required
|
|
2767
|
+
*
|
|
2768
|
+
* // Start a process by name with specific robots
|
|
2769
|
+
* const process = await sdk.processes.start({
|
|
2770
|
+
* processName: "MyProcess"
|
|
2771
|
+
* }, <folderId>); // folderId is required
|
|
2772
|
+
* ```
|
|
2773
|
+
*/
|
|
2774
|
+
start(request: ProcessStartRequest, folderId: number, options?: RequestOptions): Promise<ProcessStartResponse[]>;
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
/**
|
|
2778
|
+
* Service for interacting with UiPath Orchestrator Processes API
|
|
2779
|
+
*/
|
|
2780
|
+
declare class ProcessService extends BaseService implements ProcessServiceModel {
|
|
2781
|
+
/**
|
|
2782
|
+
* @hideconstructor
|
|
2783
|
+
*/
|
|
2784
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager);
|
|
2785
|
+
/**
|
|
2786
|
+
* Gets all processes across folders with optional filtering and folder scoping
|
|
2787
|
+
*
|
|
2788
|
+
* The method returns either:
|
|
2789
|
+
* - An array of processes (when no pagination parameters are provided)
|
|
2790
|
+
* - A paginated result with navigation cursors (when any pagination parameter is provided)
|
|
2791
|
+
*
|
|
2792
|
+
* @param options - Query options including optional folderId
|
|
2793
|
+
* @returns Promise resolving to an array of processes or paginated result
|
|
2794
|
+
*
|
|
2795
|
+
* @example
|
|
2796
|
+
* ```typescript
|
|
2797
|
+
* // Standard array return
|
|
2798
|
+
* const processes = await sdk.processes.getAll();
|
|
2799
|
+
*
|
|
2800
|
+
* // Get processes within a specific folder
|
|
2801
|
+
* const processes = await sdk.processes.getAll({
|
|
2802
|
+
* folderId: 123
|
|
2803
|
+
* });
|
|
2804
|
+
*
|
|
2805
|
+
* // Get processes with filtering
|
|
2806
|
+
* const processes = await sdk.processes.getAll({
|
|
2807
|
+
* filter: "name eq 'MyProcess'"
|
|
2808
|
+
* });
|
|
2809
|
+
*
|
|
2810
|
+
* // First page with pagination
|
|
2811
|
+
* const page1 = await sdk.processes.getAll({ pageSize: 10 });
|
|
2812
|
+
*
|
|
2813
|
+
* // Navigate using cursor
|
|
2814
|
+
* if (page1.hasNextPage) {
|
|
2815
|
+
* const page2 = await sdk.processes.getAll({ cursor: page1.nextCursor });
|
|
2816
|
+
* }
|
|
2817
|
+
*
|
|
2818
|
+
* // Jump to specific page
|
|
2819
|
+
* const page5 = await sdk.processes.getAll({
|
|
2820
|
+
* jumpToPage: 5,
|
|
2821
|
+
* pageSize: 10
|
|
2822
|
+
* });
|
|
2823
|
+
* ```
|
|
2824
|
+
*/
|
|
2825
|
+
getAll<T extends ProcessGetAllOptions = ProcessGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ProcessGetResponse> : NonPaginatedResponse<ProcessGetResponse>>;
|
|
2826
|
+
/**
|
|
2827
|
+
* Starts a process execution (job)
|
|
2828
|
+
*
|
|
2829
|
+
* @param request - Process start request body
|
|
2830
|
+
* @param folderId - Required folder ID
|
|
2831
|
+
* @param options - Optional query parameters
|
|
2832
|
+
* @returns Promise resolving to the created jobs
|
|
2833
|
+
*
|
|
2834
|
+
* @example
|
|
2835
|
+
* ```typescript
|
|
2836
|
+
* // Start a process by process key
|
|
2837
|
+
* const jobs = await sdk.processes.start({
|
|
2838
|
+
* processKey: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
2839
|
+
* }, 123); // folderId is required
|
|
2840
|
+
*
|
|
2841
|
+
* // Start a process by name with specific robots
|
|
2842
|
+
* const jobs = await sdk.processes.start({
|
|
2843
|
+
* processName: "MyProcess"
|
|
2844
|
+
* }, 123); // folderId is required
|
|
2845
|
+
* ```
|
|
2846
|
+
*/
|
|
2847
|
+
start(request: ProcessStartRequest, folderId: number, options?: RequestOptions): Promise<ProcessStartResponse[]>;
|
|
2848
|
+
/**
|
|
2849
|
+
* Gets a single process by ID
|
|
2850
|
+
*
|
|
2851
|
+
* @param id - Process ID
|
|
2852
|
+
* @param folderId - Required folder ID
|
|
2853
|
+
* @param options - Optional query parameters
|
|
2854
|
+
* @returns Promise resolving to a single process
|
|
2855
|
+
*
|
|
2856
|
+
* @example
|
|
2857
|
+
* ```typescript
|
|
2858
|
+
* // Get process by ID
|
|
2859
|
+
* const process = await sdk.processes.getById(123, 456);
|
|
2860
|
+
* ```
|
|
2861
|
+
*/
|
|
2862
|
+
getById(id: number, folderId: number, options?: ProcessGetByIdOptions): Promise<ProcessGetResponse>;
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
/**
|
|
2866
|
+
* Interface for queue response
|
|
2867
|
+
*/
|
|
2868
|
+
interface QueueGetResponse {
|
|
2869
|
+
key: string;
|
|
2870
|
+
name: string;
|
|
2871
|
+
id: number;
|
|
2872
|
+
description: string;
|
|
2873
|
+
maxNumberOfRetries: number;
|
|
2874
|
+
acceptAutomaticallyRetry: boolean;
|
|
2875
|
+
retryAbandonedItems: boolean;
|
|
2876
|
+
enforceUniqueReference: boolean;
|
|
2877
|
+
encrypted: boolean;
|
|
2878
|
+
specificDataJsonSchema: string | null;
|
|
2879
|
+
outputDataJsonSchema: string | null;
|
|
2880
|
+
analyticsDataJsonSchema: string | null;
|
|
2881
|
+
createdTime: string;
|
|
2882
|
+
processScheduleId: number | null;
|
|
2883
|
+
slaInMinutes: number;
|
|
2884
|
+
riskSlaInMinutes: number;
|
|
2885
|
+
releaseId: number | null;
|
|
2886
|
+
isProcessInCurrentFolder: boolean | null;
|
|
2887
|
+
foldersCount: number;
|
|
2888
|
+
folderId: number;
|
|
2889
|
+
folderName: string;
|
|
2890
|
+
}
|
|
2891
|
+
/**
|
|
2892
|
+
* Options for getting queues across folders
|
|
2893
|
+
*/
|
|
2894
|
+
type QueueGetAllOptions = RequestOptions & PaginationOptions & {
|
|
2895
|
+
/**
|
|
2896
|
+
* Optional folder ID to filter queues by folder
|
|
2897
|
+
*/
|
|
2898
|
+
folderId?: number;
|
|
2899
|
+
};
|
|
2900
|
+
type QueueGetByIdOptions = BaseOptions;
|
|
2901
|
+
|
|
2902
|
+
/**
|
|
2903
|
+
* Service for managing UiPath Queues
|
|
2904
|
+
*
|
|
2905
|
+
* Queues are a fundamental component of UiPath automation that enable distributed and scalable processing of work items. [UiPath Queues Guide](https://docs.uipath.com/orchestrator/automation-cloud/latest/user-guide/about-queues-and-transactions)
|
|
2906
|
+
*/
|
|
2907
|
+
interface QueueServiceModel {
|
|
2908
|
+
/**
|
|
2909
|
+
* Gets all queues across folders with optional filtering and folder scoping
|
|
2910
|
+
*
|
|
2911
|
+
* @signature getAll(options?) → Promise<QueueGetResponse[]>
|
|
2912
|
+
* @param options Query options including optional folderId and pagination options
|
|
2913
|
+
* @returns Promise resolving to either an array of queues NonPaginatedResponse<QueueGetResponse> or a PaginatedResponse<QueueGetResponse> when pagination options are used.
|
|
2914
|
+
* {@link QueueGetResponse}
|
|
2915
|
+
* @example
|
|
2916
|
+
* ```typescript
|
|
2917
|
+
* // Standard array return
|
|
2918
|
+
* const queues = await sdk.queues.getAll();
|
|
2919
|
+
*
|
|
2920
|
+
* // Get queues within a specific folder
|
|
2921
|
+
* const queues = await sdk.queues.getAll({
|
|
2922
|
+
* folderId: <folderId>
|
|
2923
|
+
* });
|
|
2924
|
+
*
|
|
2925
|
+
* // Get queues with filtering
|
|
2926
|
+
* const queues = await sdk.queues.getAll({
|
|
2927
|
+
* filter: "name eq 'MyQueue'"
|
|
2928
|
+
* });
|
|
2929
|
+
*
|
|
2930
|
+
* // First page with pagination
|
|
2931
|
+
* const page1 = await sdk.queues.getAll({ pageSize: 10 });
|
|
2932
|
+
*
|
|
2933
|
+
* // Navigate using cursor
|
|
2934
|
+
* if (page1.hasNextPage) {
|
|
2935
|
+
* const page2 = await sdk.queues.getAll({ cursor: page1.nextCursor });
|
|
2936
|
+
* }
|
|
2937
|
+
*
|
|
2938
|
+
* // Jump to specific page
|
|
2939
|
+
* const page5 = await sdk.queues.getAll({
|
|
2940
|
+
* jumpToPage: 5,
|
|
2941
|
+
* pageSize: 10
|
|
2942
|
+
* });
|
|
2943
|
+
* ```
|
|
2944
|
+
*/
|
|
2945
|
+
getAll<T extends QueueGetAllOptions = QueueGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<QueueGetResponse> : NonPaginatedResponse<QueueGetResponse>>;
|
|
2946
|
+
/**
|
|
2947
|
+
* Gets a single queue by ID
|
|
2948
|
+
*
|
|
2949
|
+
* @param id - Queue ID
|
|
2950
|
+
* @param folderId - Required folder ID
|
|
2951
|
+
* @returns Promise resolving to a queue definition
|
|
2952
|
+
* @example
|
|
2953
|
+
* ```typescript
|
|
2954
|
+
* // Get queue by ID
|
|
2955
|
+
* const queue = await sdk.queues.getById(<queueId>, <folderId>);
|
|
2956
|
+
* ```
|
|
2957
|
+
*/
|
|
2958
|
+
getById(id: number, folderId: number, options?: QueueGetByIdOptions): Promise<QueueGetResponse>;
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* Service for interacting with UiPath Orchestrator Queues API
|
|
2963
|
+
*/
|
|
2964
|
+
declare class QueueService extends FolderScopedService implements QueueServiceModel {
|
|
2965
|
+
/**
|
|
2966
|
+
* @hideconstructor
|
|
2967
|
+
*/
|
|
2968
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager);
|
|
2969
|
+
/**
|
|
2970
|
+
* Gets all queues across folders with optional filtering and folder scoping
|
|
2971
|
+
*
|
|
2972
|
+
* The method returns either:
|
|
2973
|
+
* - An array of queues (when no pagination parameters are provided)
|
|
2974
|
+
* - A paginated result with navigation cursors (when any pagination parameter is provided)
|
|
2975
|
+
*
|
|
2976
|
+
* @param options - Query options including optional folderId
|
|
2977
|
+
* @returns Promise resolving to an array of queues or paginated result
|
|
2978
|
+
*
|
|
2979
|
+
* @example
|
|
2980
|
+
* ```typescript
|
|
2981
|
+
* // Standard array return
|
|
2982
|
+
* const queues = await sdk.queues.getAll();
|
|
2983
|
+
*
|
|
2984
|
+
* // Get queues within a specific folder
|
|
2985
|
+
* const queues = await sdk.queues.getAll({
|
|
2986
|
+
* folderId: 123
|
|
2987
|
+
* });
|
|
2988
|
+
*
|
|
2989
|
+
* // Get queues with filtering
|
|
2990
|
+
* const queues = await sdk.queues.getAll({
|
|
2991
|
+
* filter: "name eq 'MyQueue'"
|
|
2992
|
+
* });
|
|
2993
|
+
*
|
|
2994
|
+
* // First page with pagination
|
|
2995
|
+
* const page1 = await sdk.queues.getAll({ pageSize: 10 });
|
|
2996
|
+
*
|
|
2997
|
+
* // Navigate using cursor
|
|
2998
|
+
* if (page1.hasNextPage) {
|
|
2999
|
+
* const page2 = await sdk.queues.getAll({ cursor: page1.nextCursor });
|
|
3000
|
+
* }
|
|
3001
|
+
*
|
|
3002
|
+
* // Jump to specific page
|
|
3003
|
+
* const page5 = await sdk.queues.getAll({
|
|
3004
|
+
* jumpToPage: 5,
|
|
3005
|
+
* pageSize: 10
|
|
3006
|
+
* });
|
|
3007
|
+
* ```
|
|
3008
|
+
*/
|
|
3009
|
+
getAll<T extends QueueGetAllOptions = QueueGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<QueueGetResponse> : NonPaginatedResponse<QueueGetResponse>>;
|
|
3010
|
+
/**
|
|
3011
|
+
* Gets a single queue by ID
|
|
3012
|
+
*
|
|
3013
|
+
* @param id - Queue ID
|
|
3014
|
+
* @param folderId - Required folder ID
|
|
3015
|
+
* @returns Promise resolving to a queue definition
|
|
3016
|
+
*
|
|
3017
|
+
* @example
|
|
3018
|
+
* ```typescript
|
|
3019
|
+
* // Get queue by ID
|
|
3020
|
+
* const queue = await sdk.queues.getById(123, 456);
|
|
3021
|
+
* ```
|
|
3022
|
+
*/
|
|
3023
|
+
getById(id: number, folderId: number, options?: QueueGetByIdOptions): Promise<QueueGetResponse>;
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
interface UserLoginInfo {
|
|
3027
|
+
name: string;
|
|
3028
|
+
surname: string;
|
|
3029
|
+
userName: string;
|
|
3030
|
+
emailAddress: string;
|
|
3031
|
+
displayName: string;
|
|
3032
|
+
id: number;
|
|
3033
|
+
}
|
|
3034
|
+
declare enum TaskType {
|
|
3035
|
+
Form = "FormTask",
|
|
3036
|
+
External = "ExternalTask",
|
|
3037
|
+
App = "AppTask"
|
|
3038
|
+
}
|
|
3039
|
+
declare enum TaskPriority {
|
|
3040
|
+
Low = "Low",
|
|
3041
|
+
Medium = "Medium",
|
|
3042
|
+
High = "High",
|
|
3043
|
+
Critical = "Critical"
|
|
3044
|
+
}
|
|
3045
|
+
declare enum TaskStatus {
|
|
3046
|
+
Unassigned = "Unassigned",
|
|
3047
|
+
Pending = "Pending",
|
|
3048
|
+
Completed = "Completed"
|
|
3049
|
+
}
|
|
3050
|
+
declare enum TaskSlaCriteria {
|
|
3051
|
+
TaskCreated = "TaskCreated",
|
|
3052
|
+
TaskAssigned = "TaskAssigned",
|
|
3053
|
+
TaskCompleted = "TaskCompleted"
|
|
3054
|
+
}
|
|
3055
|
+
declare enum TaskSlaStatus {
|
|
3056
|
+
OverdueLater = "OverdueLater",
|
|
3057
|
+
OverdueSoon = "OverdueSoon",
|
|
3058
|
+
Overdue = "Overdue",
|
|
3059
|
+
CompletedInTime = "CompletedInTime"
|
|
3060
|
+
}
|
|
3061
|
+
declare enum TaskSourceName {
|
|
3062
|
+
Agent = "Agent",
|
|
3063
|
+
Workflow = "Workflow",
|
|
3064
|
+
Maestro = "Maestro",
|
|
3065
|
+
Default = "Default"
|
|
3066
|
+
}
|
|
3067
|
+
interface TaskSource {
|
|
3068
|
+
sourceName: TaskSourceName;
|
|
3069
|
+
sourceId: string;
|
|
3070
|
+
taskSourceMetadata: Record<string, unknown>;
|
|
3071
|
+
}
|
|
3072
|
+
interface TaskSlaDetail {
|
|
3073
|
+
expiryTime?: string;
|
|
3074
|
+
startCriteria?: TaskSlaCriteria;
|
|
3075
|
+
endCriteria?: TaskSlaCriteria;
|
|
3076
|
+
status?: TaskSlaStatus;
|
|
3077
|
+
}
|
|
3078
|
+
interface TaskAssignment {
|
|
3079
|
+
assignee?: UserLoginInfo;
|
|
3080
|
+
task?: RawTaskGetResponse;
|
|
3081
|
+
id?: number;
|
|
3082
|
+
}
|
|
3083
|
+
/**
|
|
3084
|
+
* Base interface containing common fields shared across all task response types
|
|
3085
|
+
*/
|
|
3086
|
+
interface TaskBaseResponse {
|
|
3087
|
+
status: TaskStatus;
|
|
3088
|
+
title: string;
|
|
3089
|
+
type: TaskType;
|
|
3090
|
+
priority: TaskPriority;
|
|
3091
|
+
organizationUnitId: number;
|
|
3092
|
+
key: string;
|
|
3093
|
+
isDeleted: boolean;
|
|
3094
|
+
creationTime: string;
|
|
3095
|
+
creatorUserId: number;
|
|
3096
|
+
id: number;
|
|
3097
|
+
action: string | null;
|
|
3098
|
+
assignedToUserId: number | null;
|
|
3099
|
+
externalTag: string | null;
|
|
3100
|
+
lastAssignedTime: string | null;
|
|
3101
|
+
completionTime: string | null;
|
|
3102
|
+
parentOperationId: string | null;
|
|
3103
|
+
deleterUserId: number | null;
|
|
3104
|
+
deletionTime: string | null;
|
|
3105
|
+
lastModificationTime: string | null;
|
|
3106
|
+
}
|
|
3107
|
+
interface TaskCreateOptions {
|
|
3108
|
+
title: string;
|
|
3109
|
+
priority?: TaskPriority;
|
|
3110
|
+
}
|
|
3111
|
+
interface RawTaskCreateResponse extends TaskBaseResponse {
|
|
3112
|
+
waitJobState: JobState | null;
|
|
3113
|
+
assignedToUser: UserLoginInfo | null;
|
|
3114
|
+
taskSlaDetails: TaskSlaDetail[] | null;
|
|
3115
|
+
completedByUser: UserLoginInfo | null;
|
|
3116
|
+
taskAssignees: UserLoginInfo[] | null;
|
|
3117
|
+
processingTime: number | null;
|
|
3118
|
+
data: Record<string, unknown> | null;
|
|
3119
|
+
}
|
|
3120
|
+
interface RawTaskGetResponse extends TaskBaseResponse {
|
|
3121
|
+
isCompleted: boolean;
|
|
3122
|
+
encrypted: boolean;
|
|
3123
|
+
bulkFormLayoutId: number | null;
|
|
3124
|
+
formLayoutId: number | null;
|
|
3125
|
+
taskSlaDetail: TaskSlaDetail | null;
|
|
3126
|
+
taskAssigneeName: string | null;
|
|
3127
|
+
lastModifierUserId: number | null;
|
|
3128
|
+
assignedToUser?: UserLoginInfo;
|
|
3129
|
+
creatorUser?: UserLoginInfo;
|
|
3130
|
+
lastModifierUser?: UserLoginInfo;
|
|
3131
|
+
taskAssignments?: TaskAssignment[];
|
|
3132
|
+
formLayout?: Record<string, unknown>;
|
|
3133
|
+
actionLabel?: string | null;
|
|
3134
|
+
taskSlaDetails?: TaskSlaDetail[] | null;
|
|
3135
|
+
completedByUser?: UserLoginInfo | null;
|
|
3136
|
+
taskAssignmentCriteria?: string;
|
|
3137
|
+
taskAssignees?: UserLoginInfo[] | null;
|
|
3138
|
+
taskSource?: TaskSource | null;
|
|
3139
|
+
processingTime?: number | null;
|
|
3140
|
+
data?: Record<string, unknown> | null;
|
|
3141
|
+
}
|
|
3142
|
+
interface TaskAssignmentOptions {
|
|
3143
|
+
taskId: number;
|
|
3144
|
+
userId: number;
|
|
3145
|
+
userNameOrEmail?: string;
|
|
3146
|
+
}
|
|
3147
|
+
interface TasksUnassignOptions {
|
|
3148
|
+
taskIds: number[];
|
|
3149
|
+
}
|
|
3150
|
+
interface TaskAssignmentResponse {
|
|
3151
|
+
taskId?: number;
|
|
3152
|
+
userId?: number;
|
|
3153
|
+
errorCode?: number;
|
|
3154
|
+
errorMessage?: string;
|
|
3155
|
+
userNameOrEmail?: string;
|
|
3156
|
+
}
|
|
3157
|
+
interface TaskCompletionOptions {
|
|
3158
|
+
taskId: number;
|
|
3159
|
+
data?: any;
|
|
3160
|
+
action?: string;
|
|
3161
|
+
}
|
|
3162
|
+
/**
|
|
3163
|
+
* Options for task assignment operations in the Task class
|
|
3164
|
+
* At least one identification parameter is required
|
|
3165
|
+
*/
|
|
3166
|
+
type TaskAssignOptions = {
|
|
3167
|
+
userId: number;
|
|
3168
|
+
userNameOrEmail?: string;
|
|
3169
|
+
} | {
|
|
3170
|
+
userId?: number;
|
|
3171
|
+
userNameOrEmail: string;
|
|
3172
|
+
};
|
|
3173
|
+
/**
|
|
3174
|
+
* Options for completing a task
|
|
3175
|
+
*/
|
|
3176
|
+
type TaskCompleteOptions = {
|
|
3177
|
+
type: TaskType.External;
|
|
3178
|
+
data?: any;
|
|
3179
|
+
action?: string;
|
|
3180
|
+
} | {
|
|
3181
|
+
type: Exclude<TaskType, TaskType.External>;
|
|
3182
|
+
data: any;
|
|
3183
|
+
action: string;
|
|
3184
|
+
};
|
|
3185
|
+
/**
|
|
3186
|
+
* Options for getting tasks across folders
|
|
3187
|
+
*/
|
|
3188
|
+
type TaskGetAllOptions = RequestOptions & PaginationOptions & {
|
|
3189
|
+
/**
|
|
3190
|
+
* Optional folder ID to filter tasks by folder
|
|
3191
|
+
*/
|
|
3192
|
+
folderId?: number;
|
|
3193
|
+
};
|
|
3194
|
+
/**
|
|
3195
|
+
* Query options for getting a task by ID
|
|
3196
|
+
*/
|
|
3197
|
+
type TaskGetByIdOptions = BaseOptions;
|
|
3198
|
+
/**
|
|
3199
|
+
* Options for getting users with task permissions
|
|
3200
|
+
*/
|
|
3201
|
+
type TaskGetUsersOptions = RequestOptions & PaginationOptions;
|
|
3202
|
+
|
|
3203
|
+
/**
|
|
3204
|
+
* Service for managing UiPath Action Center
|
|
3205
|
+
*
|
|
3206
|
+
* Tasks are task-based automation components that can be integrated into applications and processes. They represent discrete units of work that can be triggered and monitored through the UiPath API. [UiPath Action Center Guide](https://docs.uipath.com/automation-cloud/docs/actions)
|
|
3207
|
+
*
|
|
3208
|
+
*/
|
|
3209
|
+
interface TaskServiceModel {
|
|
3210
|
+
/**
|
|
3211
|
+
* Gets all tasks across folders with optional filtering
|
|
3212
|
+
*
|
|
3213
|
+
* @param options - Query options including optional folderId and pagination options
|
|
3214
|
+
* @returns Promise resolving to either an array of tasks NonPaginatedResponse<TaskGetResponse> or a PaginatedResponse<TaskGetResponse> when pagination options are used.
|
|
3215
|
+
* {@link TaskGetResponse}
|
|
3216
|
+
*/
|
|
3217
|
+
getAll<T extends TaskGetAllOptions = TaskGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<TaskGetResponse> : NonPaginatedResponse<TaskGetResponse>>;
|
|
3218
|
+
getById(id: number, options?: TaskGetByIdOptions, folderId?: number): Promise<TaskGetResponse>;
|
|
3219
|
+
create(options: TaskCreateOptions, folderId: number): Promise<TaskCreateResponse>;
|
|
3220
|
+
assign(options: TaskAssignmentOptions | TaskAssignmentOptions[], folderId?: number): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
3221
|
+
reassign(options: TaskAssignmentOptions | TaskAssignmentOptions[], folderId?: number): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
3222
|
+
unassign(taskId: number | number[], folderId?: number): Promise<OperationResponse<{
|
|
3223
|
+
taskId: number;
|
|
3224
|
+
}[] | TaskAssignmentResponse[]>>;
|
|
3225
|
+
complete(taskType: TaskType, options: TaskCompletionOptions, folderId: number): Promise<OperationResponse<TaskCompletionOptions>>;
|
|
3226
|
+
/**
|
|
3227
|
+
* Gets users in the given folder who have Tasks.View and Tasks.Edit permissions
|
|
3228
|
+
* Returns a NonPaginatedResponse with data and totalCount when no pagination parameters are provided,
|
|
3229
|
+
* or a PaginatedResponse when any pagination parameter is provided
|
|
3230
|
+
*
|
|
3231
|
+
* @param folderId - The folder ID to get users from
|
|
3232
|
+
* @param options - Optional query and pagination parameters
|
|
3233
|
+
* @returns Promise resolving to NonPaginatedResponse or a paginated result
|
|
3234
|
+
*/
|
|
3235
|
+
getUsers<T extends TaskGetUsersOptions = TaskGetUsersOptions>(folderId: number, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<UserLoginInfo> : NonPaginatedResponse<UserLoginInfo>>;
|
|
3236
|
+
}
|
|
3237
|
+
interface TaskMethods {
|
|
3238
|
+
/**
|
|
3239
|
+
* Assigns this task to a user or users
|
|
3240
|
+
*
|
|
3241
|
+
* @param options - Assignment options (requires at least one of: userId, userNameOrEmail)
|
|
3242
|
+
* @returns Promise resolving to task assignment results
|
|
3243
|
+
*/
|
|
3244
|
+
assign(options: TaskAssignOptions): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
3245
|
+
/**
|
|
3246
|
+
* Reassigns this task to a new user
|
|
3247
|
+
*
|
|
3248
|
+
* @param options - Assignment options (requires at least one of: userId, userNameOrEmail)
|
|
3249
|
+
* @returns Promise resolving to task assignment results
|
|
3250
|
+
*/
|
|
3251
|
+
reassign(options: TaskAssignOptions): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
3252
|
+
/**
|
|
3253
|
+
* Unassigns this task (removes current assignee)
|
|
3254
|
+
*
|
|
3255
|
+
* @returns Promise resolving to task assignment results
|
|
3256
|
+
*/
|
|
3257
|
+
unassign(): Promise<OperationResponse<{
|
|
3258
|
+
taskId: number;
|
|
3259
|
+
}[] | TaskAssignmentResponse[]>>;
|
|
3260
|
+
/**
|
|
3261
|
+
* Completes this task with optional data and action
|
|
3262
|
+
*
|
|
3263
|
+
* @param options - Completion options
|
|
3264
|
+
* @returns Promise resolving to completion result
|
|
3265
|
+
*/
|
|
3266
|
+
complete(options: TaskCompleteOptions): Promise<OperationResponse<TaskCompletionOptions>>;
|
|
3267
|
+
}
|
|
3268
|
+
type TaskGetResponse = RawTaskGetResponse & TaskMethods;
|
|
3269
|
+
type TaskCreateResponse = RawTaskCreateResponse & TaskMethods;
|
|
3270
|
+
/**
|
|
3271
|
+
* Creates an actionable task by combining API task data with operational methods.
|
|
3272
|
+
*
|
|
3273
|
+
* @param taskData - The task data from API
|
|
3274
|
+
* @param service - The task service instance
|
|
3275
|
+
* @returns A task object with added methods
|
|
3276
|
+
*/
|
|
3277
|
+
declare function createTaskWithMethods(taskData: RawTaskGetResponse | RawTaskCreateResponse, service: TaskServiceModel): TaskGetResponse | TaskCreateResponse;
|
|
3278
|
+
|
|
3279
|
+
/**
|
|
3280
|
+
* Service for interacting with UiPath Tasks API
|
|
3281
|
+
*/
|
|
3282
|
+
declare class TaskService extends BaseService implements TaskServiceModel {
|
|
3283
|
+
/**
|
|
3284
|
+
* @hideconstructor
|
|
3285
|
+
*/
|
|
3286
|
+
constructor(config: Config, executionContext: ExecutionContext, tokenManager: TokenManager);
|
|
3287
|
+
/**
|
|
3288
|
+
* Creates a new task
|
|
3289
|
+
* @param task - The task to be created
|
|
3290
|
+
* @param folderId - Required folder ID
|
|
3291
|
+
* @returns Promise resolving to the created task
|
|
3292
|
+
*
|
|
3293
|
+
* @example
|
|
3294
|
+
* ```typescript
|
|
3295
|
+
* const task = await sdk.tasks.create({
|
|
3296
|
+
* title: "My Task",
|
|
3297
|
+
* priority: TaskPriority.Medium,
|
|
3298
|
+
* data: { key: "value" }
|
|
3299
|
+
* }, 123); // folderId is required
|
|
3300
|
+
* ```
|
|
3301
|
+
*/
|
|
3302
|
+
create(task: TaskCreateOptions, folderId: number): Promise<TaskCreateResponse>;
|
|
3303
|
+
/**
|
|
3304
|
+
* Gets users in the given folder who have Tasks.View and Tasks.Edit permissions
|
|
3305
|
+
*
|
|
3306
|
+
* The method returns either:
|
|
3307
|
+
* - An array of users (when no pagination parameters are provided)
|
|
3308
|
+
* - A paginated result with navigation cursors (when any pagination parameter is provided)
|
|
3309
|
+
*
|
|
3310
|
+
* @param folderId - The folder ID to get users from
|
|
3311
|
+
* @param options - Optional query and pagination parameters
|
|
3312
|
+
* @returns Promise resolving to an array of users or paginated result
|
|
3313
|
+
*
|
|
3314
|
+
* @example
|
|
3315
|
+
* ```typescript
|
|
3316
|
+
* // Standard array return
|
|
3317
|
+
* const users = await sdk.tasks.getUsers(123);
|
|
3318
|
+
*
|
|
3319
|
+
* // Get users with filtering
|
|
3320
|
+
* const users = await sdk.tasks.getUsers(123, {
|
|
3321
|
+
* filter: "name eq 'abc'"
|
|
3322
|
+
* });
|
|
3323
|
+
*
|
|
3324
|
+
* // First page with pagination
|
|
3325
|
+
* const page1 = await sdk.tasks.getUsers(123, { pageSize: 10 });
|
|
3326
|
+
*
|
|
3327
|
+
* // Navigate using cursor
|
|
3328
|
+
* if (page1.hasNextPage) {
|
|
3329
|
+
* const page2 = await sdk.tasks.getUsers(123, { cursor: page1.nextCursor });
|
|
3330
|
+
* }
|
|
3331
|
+
*
|
|
3332
|
+
* // Jump to specific page
|
|
3333
|
+
* const page5 = await sdk.tasks.getUsers(123, {
|
|
3334
|
+
* jumpToPage: 5,
|
|
3335
|
+
* pageSize: 10
|
|
3336
|
+
* });
|
|
3337
|
+
* ```
|
|
3338
|
+
*/
|
|
3339
|
+
getUsers<T extends TaskGetUsersOptions = TaskGetUsersOptions>(folderId: number, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<UserLoginInfo> : NonPaginatedResponse<UserLoginInfo>>;
|
|
3340
|
+
/**
|
|
3341
|
+
* Gets tasks across folders with optional filtering and folder scoping
|
|
3342
|
+
*
|
|
3343
|
+
* The method returns either:
|
|
3344
|
+
* - An array of tasks (when no pagination parameters are provided)
|
|
3345
|
+
* - A paginated result with navigation cursors (when any pagination parameter is provided)
|
|
3346
|
+
*
|
|
3347
|
+
* @param options - Query options including optional folderId and pagination options
|
|
3348
|
+
* @returns Promise resolving to an array of tasks or paginated result
|
|
3349
|
+
*
|
|
3350
|
+
* @example
|
|
3351
|
+
* ```typescript
|
|
3352
|
+
* // Standard array return
|
|
3353
|
+
* const tasks = await sdk.tasks.getAll();
|
|
3354
|
+
*
|
|
3355
|
+
* // Get tasks within a specific folder
|
|
3356
|
+
* const tasks = await sdk.tasks.getAll({
|
|
3357
|
+
* folderId: 123
|
|
3358
|
+
* });
|
|
3359
|
+
*
|
|
3360
|
+
* // First page with pagination
|
|
3361
|
+
* const page1 = await sdk.tasks.getAll({ pageSize: 10 });
|
|
3362
|
+
*
|
|
3363
|
+
* // Navigate using cursor
|
|
3364
|
+
* if (page1.hasNextPage) {
|
|
3365
|
+
* const page2 = await sdk.tasks.getAll({ cursor: page1.nextCursor });
|
|
3366
|
+
* }
|
|
3367
|
+
*
|
|
3368
|
+
* // Jump to specific page
|
|
3369
|
+
* const page5 = await sdk.tasks.getAll({
|
|
3370
|
+
* jumpToPage: 5,
|
|
3371
|
+
* pageSize: 10
|
|
3372
|
+
* });
|
|
3373
|
+
* ```
|
|
3374
|
+
*/
|
|
3375
|
+
getAll<T extends TaskGetAllOptions = TaskGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<TaskGetResponse> : NonPaginatedResponse<TaskGetResponse>>;
|
|
3376
|
+
/**
|
|
3377
|
+
* Gets a task by ID
|
|
3378
|
+
*
|
|
3379
|
+
* @param id - The ID of the task to retrieve
|
|
3380
|
+
* @param options - Optional query parameters
|
|
3381
|
+
* @param folderId - Optional folder ID
|
|
3382
|
+
* @returns Promise resolving to the task (form tasks will return form-specific data)
|
|
3383
|
+
*
|
|
3384
|
+
* @example
|
|
3385
|
+
* ```typescript
|
|
3386
|
+
* // Get task by ID
|
|
3387
|
+
* const task = await sdk.tasks.getById(123);
|
|
3388
|
+
*
|
|
3389
|
+
* // If the task is a form task, it will automatically return form-specific data
|
|
3390
|
+
* ```
|
|
3391
|
+
*/
|
|
3392
|
+
getById(id: number, options?: TaskGetByIdOptions, folderId?: number): Promise<TaskGetResponse>;
|
|
3393
|
+
/**
|
|
3394
|
+
* Assigns tasks to users
|
|
3395
|
+
*
|
|
3396
|
+
* @param taskAssignments - Single task assignment or array of task assignments
|
|
3397
|
+
* @param folderId - Optional folder ID
|
|
3398
|
+
* @returns Promise resolving to array of task assignment results
|
|
3399
|
+
*
|
|
3400
|
+
* @example
|
|
3401
|
+
* ```typescript
|
|
3402
|
+
* // Assign a single task to a user by ID
|
|
3403
|
+
* const result = await sdk.tasks.assign({
|
|
3404
|
+
* taskId: 123,
|
|
3405
|
+
* userId: 456
|
|
3406
|
+
* });
|
|
3407
|
+
*
|
|
3408
|
+
* // Assign a single task to a user by email
|
|
3409
|
+
* const result = await sdk.tasks.assign({
|
|
3410
|
+
* taskId: 123,
|
|
3411
|
+
* userNameOrEmail: "user@example.com"
|
|
3412
|
+
* });
|
|
3413
|
+
*
|
|
3414
|
+
* // Assign multiple tasks
|
|
3415
|
+
* const result = await sdk.tasks.assign([
|
|
3416
|
+
* {
|
|
3417
|
+
* taskId: 123,
|
|
3418
|
+
* userId: 456
|
|
3419
|
+
* },
|
|
3420
|
+
* {
|
|
3421
|
+
* taskId: 789,
|
|
3422
|
+
* userNameOrEmail: "user@example.com"
|
|
3423
|
+
* }
|
|
3424
|
+
* ]);
|
|
3425
|
+
* ```
|
|
3426
|
+
*/
|
|
3427
|
+
assign(taskAssignments: TaskAssignmentOptions | TaskAssignmentOptions[], folderId?: number): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
3428
|
+
/**
|
|
3429
|
+
* Reassigns tasks to new users
|
|
3430
|
+
*
|
|
3431
|
+
* @param taskAssignments - Single task assignment or array of task assignments
|
|
3432
|
+
* @param folderId - Optional folder ID
|
|
3433
|
+
* @returns Promise resolving to array of task assignment results
|
|
3434
|
+
*
|
|
3435
|
+
* @example
|
|
3436
|
+
* ```typescript
|
|
3437
|
+
* // Reassign a single task to a user by ID
|
|
3438
|
+
* const result = await sdk.tasks.reassign({
|
|
3439
|
+
* taskId: 123,
|
|
3440
|
+
* userId: 456
|
|
3441
|
+
* });
|
|
3442
|
+
*
|
|
3443
|
+
* // Reassign a single task to a user by email
|
|
3444
|
+
* const result = await sdk.tasks.reassign({
|
|
3445
|
+
* taskId: 123,
|
|
3446
|
+
* userNameOrEmail: "user@example.com"
|
|
3447
|
+
* });
|
|
3448
|
+
*
|
|
3449
|
+
* // Reassign multiple tasks
|
|
3450
|
+
* const result = await sdk.tasks.reassign([
|
|
3451
|
+
* {
|
|
3452
|
+
* taskId: 123,
|
|
3453
|
+
* userId: 456
|
|
3454
|
+
* },
|
|
3455
|
+
* {
|
|
3456
|
+
* taskId: 789,
|
|
3457
|
+
* userNameOrEmail: "user@example.com"
|
|
3458
|
+
* }
|
|
3459
|
+
* ]);
|
|
3460
|
+
* ```
|
|
3461
|
+
*/
|
|
3462
|
+
reassign(taskAssignments: TaskAssignmentOptions | TaskAssignmentOptions[], folderId?: number): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
3463
|
+
/**
|
|
3464
|
+
* Unassigns tasks (removes current assignees)
|
|
3465
|
+
*
|
|
3466
|
+
* @param taskIds - Single task ID or array of task IDs to unassign
|
|
3467
|
+
* @param folderId - Optional folder ID
|
|
3468
|
+
* @returns Promise resolving to array of task assignment results
|
|
3469
|
+
*
|
|
3470
|
+
* @example
|
|
3471
|
+
* ```typescript
|
|
3472
|
+
* // Unassign a single task
|
|
3473
|
+
* const result = await sdk.tasks.unassign(123);
|
|
3474
|
+
*
|
|
3475
|
+
* // Unassign multiple tasks
|
|
3476
|
+
* const result = await sdk.tasks.unassign([123, 456, 789]);
|
|
3477
|
+
* ```
|
|
3478
|
+
*/
|
|
3479
|
+
unassign(taskIds: number | number[], folderId?: number): Promise<OperationResponse<{
|
|
3480
|
+
taskId: number;
|
|
3481
|
+
}[] | TaskAssignmentResponse[]>>;
|
|
3482
|
+
/**
|
|
3483
|
+
* Completes a task with the specified type and data
|
|
3484
|
+
*
|
|
3485
|
+
* @param completionType - The type of task (Form, App, or Generic)
|
|
3486
|
+
* @param options - The completion options
|
|
3487
|
+
* @param folderId - Required folder ID
|
|
3488
|
+
* @returns Promise resolving to void
|
|
3489
|
+
*
|
|
3490
|
+
* @example
|
|
3491
|
+
* ```typescript
|
|
3492
|
+
* // Complete an app task
|
|
3493
|
+
* await sdk.tasks.complete(TaskType.App, {
|
|
3494
|
+
* taskId: 456,
|
|
3495
|
+
* data: {},
|
|
3496
|
+
* action: "submit"
|
|
3497
|
+
* }, 123); // folderId is required
|
|
3498
|
+
*
|
|
3499
|
+
* // Complete an external task
|
|
3500
|
+
* await sdk.tasks.complete(TaskType.ExternalTask, {
|
|
3501
|
+
* taskId: 789
|
|
3502
|
+
* }, 123); // folderId is required
|
|
3503
|
+
* ```
|
|
3504
|
+
*/
|
|
3505
|
+
complete(completionType: TaskType, options: TaskCompletionOptions, folderId: number): Promise<OperationResponse<TaskCompletionOptions>>;
|
|
3506
|
+
/**
|
|
3507
|
+
* Gets a form task by ID (private method)
|
|
3508
|
+
*
|
|
3509
|
+
* @param id - The ID of the form task to retrieve
|
|
3510
|
+
* @param folderId - Required folder ID
|
|
3511
|
+
* @param options - Optional query parameters
|
|
3512
|
+
* @returns Promise resolving to the form task
|
|
3513
|
+
*/
|
|
3514
|
+
private getFormTaskById;
|
|
3515
|
+
/**
|
|
3516
|
+
* Process parameters for task queries with folder filtering
|
|
3517
|
+
* @param options - The REST API options to process
|
|
3518
|
+
* @param folderId - Optional folder ID to filter by
|
|
3519
|
+
* @returns Processed options with folder filtering applied if needed
|
|
3520
|
+
* @private
|
|
3521
|
+
*/
|
|
3522
|
+
private processTaskParameters;
|
|
3523
|
+
}
|
|
3524
|
+
|
|
3525
|
+
interface BaseConfig {
|
|
3526
|
+
baseUrl: string;
|
|
3527
|
+
orgName: string;
|
|
3528
|
+
tenantName: string;
|
|
3529
|
+
}
|
|
3530
|
+
interface OAuthFields {
|
|
3531
|
+
clientId: string;
|
|
3532
|
+
redirectUri: string;
|
|
3533
|
+
scope: string;
|
|
3534
|
+
}
|
|
3535
|
+
type UiPathSDKConfig = BaseConfig & ({
|
|
3536
|
+
secret: string;
|
|
3537
|
+
clientId?: never;
|
|
3538
|
+
redirectUri?: never;
|
|
3539
|
+
scope?: never;
|
|
3540
|
+
} | ({
|
|
3541
|
+
secret?: never;
|
|
3542
|
+
} & OAuthFields));
|
|
3543
|
+
|
|
3544
|
+
declare class UiPath {
|
|
3545
|
+
private config;
|
|
3546
|
+
private executionContext;
|
|
3547
|
+
private authService;
|
|
3548
|
+
private initialized;
|
|
3549
|
+
private readonly _services;
|
|
3550
|
+
constructor(config: UiPathSDKConfig);
|
|
3551
|
+
/**
|
|
3552
|
+
* Initialize the SDK based on the provided configuration.
|
|
3553
|
+
* This method is only required for OAuth-based authentication.
|
|
3554
|
+
* For secret-based authentication, initialization is automatic.
|
|
3555
|
+
*/
|
|
3556
|
+
initialize(): Promise<void>;
|
|
3557
|
+
/**
|
|
3558
|
+
* Check if the SDK has been initialized
|
|
3559
|
+
*/
|
|
3560
|
+
isInitialized(): boolean;
|
|
3561
|
+
/**
|
|
3562
|
+
* Get the current authentication token
|
|
3563
|
+
*/
|
|
3564
|
+
getToken(): string | undefined;
|
|
3565
|
+
private getService;
|
|
3566
|
+
/**
|
|
3567
|
+
* Access to Maestro services
|
|
3568
|
+
*/
|
|
3569
|
+
get maestro(): {
|
|
3570
|
+
/**
|
|
3571
|
+
* Access to Maestro Processes service
|
|
3572
|
+
*/
|
|
3573
|
+
processes: MaestroProcessesService & {
|
|
3574
|
+
/**
|
|
3575
|
+
* Access to Process Instances service
|
|
3576
|
+
*/
|
|
3577
|
+
instances: ProcessInstancesService;
|
|
3578
|
+
};
|
|
3579
|
+
};
|
|
3580
|
+
/**
|
|
3581
|
+
* Access to Entity service
|
|
3582
|
+
*/
|
|
3583
|
+
get entities(): EntityService;
|
|
3584
|
+
/**
|
|
3585
|
+
* Access to Tasks service
|
|
3586
|
+
*/
|
|
3587
|
+
get tasks(): TaskService;
|
|
3588
|
+
/**
|
|
3589
|
+
* Access to Orchestrator Processes service
|
|
3590
|
+
*/
|
|
3591
|
+
get processes(): ProcessService;
|
|
3592
|
+
/**
|
|
3593
|
+
* Access to Orchestrator Buckets service
|
|
3594
|
+
*/
|
|
3595
|
+
get buckets(): BucketService;
|
|
3596
|
+
/**
|
|
3597
|
+
* Access to Orchestrator Queues service
|
|
3598
|
+
*/
|
|
3599
|
+
get queues(): QueueService;
|
|
3600
|
+
/**
|
|
3601
|
+
* Access to Orchestrator Assets service
|
|
3602
|
+
*/
|
|
3603
|
+
get assets(): AssetService;
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
/**
|
|
3607
|
+
* Error thrown when authorization fails (403 errors)
|
|
3608
|
+
* Common scenarios:
|
|
3609
|
+
* - Insufficient permissions
|
|
3610
|
+
* - Access denied to resource
|
|
3611
|
+
* - Invalid scope
|
|
3612
|
+
*/
|
|
3613
|
+
declare class AuthorizationError extends UiPathError {
|
|
3614
|
+
constructor(params?: Partial<ErrorParams>);
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
/**
|
|
3618
|
+
* Error thrown when validation fails (400 errors or client-side validation)
|
|
3619
|
+
* Common scenarios:
|
|
3620
|
+
* - Invalid input parameters
|
|
3621
|
+
* - Missing required fields
|
|
3622
|
+
* - Invalid data format
|
|
3623
|
+
*/
|
|
3624
|
+
declare class ValidationError extends UiPathError {
|
|
3625
|
+
constructor(params?: Partial<ErrorParams>);
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
/**
|
|
3629
|
+
* Error thrown when a resource is not found (404 errors)
|
|
3630
|
+
* Common scenarios:
|
|
3631
|
+
* - Resource doesn't exist
|
|
3632
|
+
* - Invalid ID provided
|
|
3633
|
+
* - Resource deleted
|
|
3634
|
+
*/
|
|
3635
|
+
declare class NotFoundError extends UiPathError {
|
|
3636
|
+
constructor(params?: Partial<ErrorParams>);
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
/**
|
|
3640
|
+
* Error thrown when rate limit is exceeded (429 errors)
|
|
3641
|
+
* Common scenarios:
|
|
3642
|
+
* - Too many requests in a time window
|
|
3643
|
+
* - API throttling
|
|
3644
|
+
*/
|
|
3645
|
+
declare class RateLimitError extends UiPathError {
|
|
3646
|
+
constructor(params?: Partial<ErrorParams>);
|
|
3647
|
+
}
|
|
3648
|
+
|
|
3649
|
+
/**
|
|
3650
|
+
* Error thrown when server encounters an error (5xx errors)
|
|
3651
|
+
* Common scenarios:
|
|
3652
|
+
* - Internal server error
|
|
3653
|
+
* - Service unavailable
|
|
3654
|
+
* - Gateway timeout
|
|
3655
|
+
*/
|
|
3656
|
+
declare class ServerError extends UiPathError {
|
|
3657
|
+
constructor(params?: Partial<ErrorParams>);
|
|
3658
|
+
/**
|
|
3659
|
+
* Checks if this is a temporary error that might succeed on retry
|
|
3660
|
+
*/
|
|
3661
|
+
get isRetryable(): boolean;
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
/**
|
|
3665
|
+
* Base error creation parameters - only what's needed
|
|
3666
|
+
*/
|
|
3667
|
+
interface ErrorParams {
|
|
3668
|
+
message: string;
|
|
3669
|
+
statusCode?: number;
|
|
3670
|
+
requestId?: string;
|
|
3671
|
+
}
|
|
3672
|
+
|
|
3673
|
+
/**
|
|
3674
|
+
* Base error class for all UiPath SDK errors
|
|
3675
|
+
* Pure TypeScript class with clean interface
|
|
3676
|
+
*/
|
|
3677
|
+
declare abstract class UiPathError {
|
|
3678
|
+
/**
|
|
3679
|
+
* Error type identifier (e.g., "AuthenticationError", "ValidationError")
|
|
3680
|
+
*/
|
|
3681
|
+
readonly type: string;
|
|
3682
|
+
/**
|
|
3683
|
+
* Error message describing what went wrong
|
|
3684
|
+
*/
|
|
3685
|
+
readonly message: string;
|
|
3686
|
+
/**
|
|
3687
|
+
* HTTP status code (400, 401, 403, 404, 500, etc.)
|
|
3688
|
+
*/
|
|
3689
|
+
readonly statusCode?: number;
|
|
3690
|
+
/**
|
|
3691
|
+
* Request ID for tracking with UiPath support
|
|
3692
|
+
*/
|
|
3693
|
+
readonly requestId?: string;
|
|
3694
|
+
/**
|
|
3695
|
+
* Timestamp when the error occurred
|
|
3696
|
+
*/
|
|
3697
|
+
readonly timestamp: Date;
|
|
3698
|
+
/**
|
|
3699
|
+
* Stack trace for debugging
|
|
3700
|
+
*/
|
|
3701
|
+
readonly stack?: string;
|
|
3702
|
+
protected constructor(type: string, params: ErrorParams);
|
|
3703
|
+
/**
|
|
3704
|
+
* Returns a clean JSON representation of the error
|
|
3705
|
+
*/
|
|
3706
|
+
private toJSON;
|
|
3707
|
+
/**
|
|
3708
|
+
* Returns detailed debug information including stack trace
|
|
3709
|
+
*/
|
|
3710
|
+
getDebugInfo(): Record<string, unknown>;
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
/**
|
|
3714
|
+
* Error thrown when authentication fails (401 errors)
|
|
3715
|
+
* Common scenarios:
|
|
3716
|
+
* - Invalid credentials
|
|
3717
|
+
* - Expired token
|
|
3718
|
+
* - Missing authentication
|
|
3719
|
+
*/
|
|
3720
|
+
declare class AuthenticationError extends UiPathError {
|
|
3721
|
+
constructor(params?: Partial<ErrorParams>);
|
|
3722
|
+
}
|
|
3723
|
+
|
|
3724
|
+
/**
|
|
3725
|
+
* Error thrown when network/connection issues occur
|
|
3726
|
+
* Common scenarios:
|
|
3727
|
+
* - Connection timeout
|
|
3728
|
+
* - DNS resolution failure
|
|
3729
|
+
* - Network unreachable
|
|
3730
|
+
* - Request aborted
|
|
3731
|
+
*/
|
|
3732
|
+
declare class NetworkError extends UiPathError {
|
|
3733
|
+
constructor(params?: Partial<ErrorParams>);
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
/**
|
|
3737
|
+
* Type guard to check if an error is a UiPathError
|
|
3738
|
+
*/
|
|
3739
|
+
declare function isUiPathError(error: unknown): error is UiPathError;
|
|
3740
|
+
/**
|
|
3741
|
+
* Type guard to check if an error is an AuthenticationError
|
|
3742
|
+
*/
|
|
3743
|
+
declare function isAuthenticationError(error: unknown): error is AuthenticationError;
|
|
3744
|
+
/**
|
|
3745
|
+
* Type guard to check if an error is an AuthorizationError
|
|
3746
|
+
*/
|
|
3747
|
+
declare function isAuthorizationError(error: unknown): error is AuthorizationError;
|
|
3748
|
+
/**
|
|
3749
|
+
* Type guard to check if an error is a ValidationError
|
|
3750
|
+
*/
|
|
3751
|
+
declare function isValidationError(error: unknown): error is ValidationError;
|
|
3752
|
+
/**
|
|
3753
|
+
* Type guard to check if an error is a NotFoundError
|
|
3754
|
+
*/
|
|
3755
|
+
declare function isNotFoundError(error: unknown): error is NotFoundError;
|
|
3756
|
+
/**
|
|
3757
|
+
* Type guard to check if an error is a RateLimitError
|
|
3758
|
+
*/
|
|
3759
|
+
declare function isRateLimitError(error: unknown): error is RateLimitError;
|
|
3760
|
+
/**
|
|
3761
|
+
* Type guard to check if an error is a ServerError
|
|
3762
|
+
*/
|
|
3763
|
+
declare function isServerError(error: unknown): error is ServerError;
|
|
3764
|
+
/**
|
|
3765
|
+
* Type guard to check if an error is a NetworkError
|
|
3766
|
+
*/
|
|
3767
|
+
declare function isNetworkError(error: unknown): error is NetworkError;
|
|
3768
|
+
/**
|
|
3769
|
+
* Helper to get error details in a safe way
|
|
3770
|
+
*/
|
|
3771
|
+
declare function getErrorDetails(error: unknown): {
|
|
3772
|
+
message: string;
|
|
3773
|
+
statusCode?: number;
|
|
3774
|
+
};
|
|
3775
|
+
|
|
3776
|
+
/**
|
|
3777
|
+
* HTTP status code constants for error handling
|
|
3778
|
+
*/
|
|
3779
|
+
declare const HttpStatus: {
|
|
3780
|
+
readonly BAD_REQUEST: 400;
|
|
3781
|
+
readonly UNAUTHORIZED: 401;
|
|
3782
|
+
readonly FORBIDDEN: 403;
|
|
3783
|
+
readonly NOT_FOUND: 404;
|
|
3784
|
+
readonly TOO_MANY_REQUESTS: 429;
|
|
3785
|
+
readonly INTERNAL_SERVER_ERROR: 500;
|
|
3786
|
+
readonly NOT_IMPLEMENTED: 501;
|
|
3787
|
+
readonly BAD_GATEWAY: 502;
|
|
3788
|
+
readonly SERVICE_UNAVAILABLE: 503;
|
|
3789
|
+
readonly GATEWAY_TIMEOUT: 504;
|
|
3790
|
+
};
|
|
3791
|
+
/**
|
|
3792
|
+
* Error type constants for consistent error identification
|
|
3793
|
+
*/
|
|
3794
|
+
declare const ErrorType: {
|
|
3795
|
+
readonly AUTHENTICATION: "AuthenticationError";
|
|
3796
|
+
readonly AUTHORIZATION: "AuthorizationError";
|
|
3797
|
+
readonly VALIDATION: "ValidationError";
|
|
3798
|
+
readonly NOT_FOUND: "NotFoundError";
|
|
3799
|
+
readonly RATE_LIMIT: "RateLimitError";
|
|
3800
|
+
readonly SERVER: "ServerError";
|
|
3801
|
+
readonly NETWORK: "NetworkError";
|
|
3802
|
+
};
|
|
3803
|
+
|
|
3804
|
+
/**
|
|
3805
|
+
* Telemetry type definitions
|
|
3806
|
+
*/
|
|
3807
|
+
interface TelemetryAttributes {
|
|
3808
|
+
[key: string]: string | number | boolean;
|
|
3809
|
+
}
|
|
3810
|
+
interface TelemetryConfig {
|
|
3811
|
+
baseUrl?: string;
|
|
3812
|
+
orgName?: string;
|
|
3813
|
+
tenantName?: string;
|
|
3814
|
+
clientId?: string;
|
|
3815
|
+
redirectUri?: string;
|
|
3816
|
+
}
|
|
3817
|
+
interface TrackOptions {
|
|
3818
|
+
condition?: boolean | ((...args: any[]) => boolean);
|
|
3819
|
+
attributes?: TelemetryAttributes;
|
|
3820
|
+
}
|
|
3821
|
+
|
|
3822
|
+
/**
|
|
3823
|
+
* SDK Track decorator and function for telemetry
|
|
3824
|
+
*/
|
|
3825
|
+
|
|
3826
|
+
/**
|
|
3827
|
+
* Track decorator that can be used to automatically track function calls
|
|
3828
|
+
*
|
|
3829
|
+
* Usage:
|
|
3830
|
+
* @track("Service.Method")
|
|
3831
|
+
* function myFunction() { ... }
|
|
3832
|
+
*
|
|
3833
|
+
* @track("Queue.GetAll")
|
|
3834
|
+
* async getAll() { ... }
|
|
3835
|
+
*
|
|
3836
|
+
* @track("Tasks.Create")
|
|
3837
|
+
* async create() { ... }
|
|
3838
|
+
*
|
|
3839
|
+
* @track("Assets.Update", { condition: false })
|
|
3840
|
+
* function myFunction() { ... }
|
|
3841
|
+
*
|
|
3842
|
+
* @track("Processes.Start", { attributes: { customProp: "value" } })
|
|
3843
|
+
* function myFunction() { ... }
|
|
3844
|
+
*/
|
|
3845
|
+
declare function track(nameOrOptions?: string | TrackOptions, options?: TrackOptions): MethodDecorator | ((target: any) => any);
|
|
3846
|
+
/**
|
|
3847
|
+
* Direct tracking function
|
|
3848
|
+
*/
|
|
3849
|
+
declare function trackEvent(eventName: string, name?: string, attributes?: TelemetryAttributes): void;
|
|
3850
|
+
|
|
3851
|
+
/**
|
|
3852
|
+
* Singleton telemetry client
|
|
3853
|
+
*/
|
|
3854
|
+
declare class TelemetryClient {
|
|
3855
|
+
private static instance;
|
|
3856
|
+
private isInitialized;
|
|
3857
|
+
private logProvider?;
|
|
3858
|
+
private logger?;
|
|
3859
|
+
private telemetryContext?;
|
|
3860
|
+
private constructor();
|
|
3861
|
+
static getInstance(): TelemetryClient;
|
|
3862
|
+
/**
|
|
3863
|
+
* Initialize telemetry
|
|
3864
|
+
*/
|
|
3865
|
+
initialize(config?: TelemetryConfig): void;
|
|
3866
|
+
private getConnectionString;
|
|
3867
|
+
private setupTelemetryProvider;
|
|
3868
|
+
/**
|
|
3869
|
+
* Track a telemetry event
|
|
3870
|
+
*/
|
|
3871
|
+
track(eventName: string, name?: string, extraAttributes?: TelemetryAttributes): void;
|
|
3872
|
+
/**
|
|
3873
|
+
* Get enriched attributes for telemetry events
|
|
3874
|
+
*/
|
|
3875
|
+
private getEnrichedAttributes;
|
|
3876
|
+
/**
|
|
3877
|
+
* Create cloud URL from base URL, organization ID, and tenant ID
|
|
3878
|
+
*/
|
|
3879
|
+
private createCloudUrl;
|
|
3880
|
+
}
|
|
3881
|
+
declare const telemetryClient: TelemetryClient;
|
|
3882
|
+
|
|
3883
|
+
/**
|
|
3884
|
+
* SDK Telemetry constants
|
|
3885
|
+
*/
|
|
3886
|
+
declare const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
|
|
3887
|
+
declare const SDK_VERSION = "1.0.0-beta.13";
|
|
3888
|
+
declare const VERSION = "Version";
|
|
3889
|
+
declare const SERVICE = "Service";
|
|
3890
|
+
declare const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
3891
|
+
declare const CLOUD_TENANT_NAME = "CloudTenantName";
|
|
3892
|
+
declare const CLOUD_URL = "CloudUrl";
|
|
3893
|
+
declare const CLOUD_CLIENT_ID = "CloudClientId";
|
|
3894
|
+
declare const CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
3895
|
+
declare const APP_NAME = "ApplicationName";
|
|
3896
|
+
declare const CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
3897
|
+
declare const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
3898
|
+
declare const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
3899
|
+
declare const SDK_RUN_EVENT = "Sdk.Run";
|
|
3900
|
+
declare const UNKNOWN = "";
|
|
3901
|
+
|
|
3902
|
+
export { APP_NAME, AssetValueScope, AssetValueType, AuthenticationError, AuthorizationError, BucketOptions, CLOUD_CLIENT_ID, CLOUD_ORGANIZATION_NAME, CLOUD_REDIRECT_URI, CLOUD_ROLE_NAME, CLOUD_TENANT_NAME, CLOUD_URL, CONNECTION_STRING, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, DataDirectionType, EntityFieldDataType, EntityType, ErrorType, FieldDisplayType, HttpStatus, JobPriority, JobState, JobType, JoinType, MAX_PAGE_SIZE, NetworkError, NotFoundError, PackageSourceType, PackageType, RateLimitError, ReferenceType, RemoteControlAccess, RobotSize, SDK_LOGGER_NAME, SDK_RUN_EVENT, SDK_SERVICE_NAME, SDK_VERSION, SERVICE, ServerError, StartStrategy, StopStrategy, TargetFramework, TaskPriority, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, UNKNOWN, UiPath, UiPathError, VERSION, ValidationError, createEntityWithMethods, createProcessInstanceWithMethods, createTaskWithMethods, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, telemetryClient, track, trackEvent };
|
|
3903
|
+
export type { ArgumentMetadata, AssetGetAllOptions, AssetGetByIdOptions, AssetGetResponse, AssetServiceModel, BaseOptions, BlobItem, BodyOptions, BpmnXmlString, BucketGetAllOptions, BucketGetByIdOptions, BucketGetFileMetaDataOptions, BucketGetFileMetaDataResponse, BucketGetFileMetaDataWithPaginationOptions, BucketGetReadUriOptions, BucketGetResponse, BucketGetUriOptions, BucketGetUriResponse, BucketGetWriteUriOptions, BucketServiceModel, BucketUploadFileOptions, BucketUploadResponse, CollectionResponse, Config, CustomKeyValuePair, ElementMetaData, EntityDeleteOptions, EntityDeleteResponse, EntityGetRecordsByIdOptions, EntityGetResponse, EntityInsertOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityRecord, EntityServiceModel, EntityUpdateOptions, EntityUpdateResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, FolderProperties, GlobalVariableMetaData, HasPaginationOptions, Headers, HttpMethod, JobAttachment, JobError, Machine, MaestroProcessGetAllResponse, MaestroProcessesServiceModel, NonPaginatedResponse, OperationResponse, PaginatedResponse, PaginationCursor, PaginationMetadata, PaginationMethodUnion, PaginationOptions, ProcessGetAllOptions, ProcessGetByIdOptions, ProcessGetResponse, ProcessInstanceExecutionHistoryResponse, ProcessInstanceGetAllOptions, ProcessInstanceGetAllWithPaginationOptions, ProcessInstanceGetResponse, ProcessInstanceGetVariablesOptions, ProcessInstanceGetVariablesResponse, ProcessInstanceMethods, ProcessInstanceOperationOptions, ProcessInstanceOperationResponse, ProcessInstanceRun, ProcessInstancesServiceModel, ProcessProperties, ProcessServiceModel, ProcessStartRequest, ProcessStartResponse, QueryParams, QueueGetAllOptions, QueueGetByIdOptions, QueueGetResponse, QueueServiceModel, RawEntityGetResponse, RawProcessInstanceGetResponse, RawTaskCreateResponse, RawTaskGetResponse, RequestOptions, RequestSpec, ResponseDictionary, ResponseType, RetryOptions, RobotMetadata, SourceJoinCriteria, TaskAssignOptions, TaskAssignment, TaskAssignmentOptions, TaskAssignmentResponse, TaskBaseResponse, TaskCompleteOptions, TaskCompletionOptions, TaskCreateOptions, TaskCreateResponse, TaskGetAllOptions, TaskGetByIdOptions, TaskGetResponse, TaskGetUsersOptions, TaskMethods, TaskServiceModel, TaskSlaDetail, TaskSource, TasksUnassignOptions, TimeoutOptions, UserLoginInfo };
|