@uipath/uipath-typescript 1.0.0-beta.10
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/LICENSE +9 -0
- package/Readme.md +260 -0
- package/dist/core/auth/service.d.ts +72 -0
- package/dist/core/auth/service.d.ts.map +1 -0
- package/dist/core/auth/service.js +244 -0
- package/dist/core/auth/service.js.map +1 -0
- package/dist/core/auth/token-manager.d.ts +82 -0
- package/dist/core/auth/token-manager.d.ts.map +1 -0
- package/dist/core/auth/token-manager.js +248 -0
- package/dist/core/auth/token-manager.js.map +1 -0
- package/dist/core/auth/types.d.ts +20 -0
- package/dist/core/auth/types.d.ts.map +1 -0
- package/dist/core/auth/types.js +2 -0
- package/dist/core/auth/types.js.map +1 -0
- package/dist/core/config/config-utils.d.ts +4 -0
- package/dist/core/config/config-utils.d.ts.map +1 -0
- package/dist/core/config/config-utils.js +13 -0
- package/dist/core/config/config-utils.js.map +1 -0
- package/dist/core/config/config.d.ts +48 -0
- package/dist/core/config/config.d.ts.map +1 -0
- package/dist/core/config/config.js +22 -0
- package/dist/core/config/config.js.map +1 -0
- package/dist/core/config/sdk-config.d.ts +33 -0
- package/dist/core/config/sdk-config.d.ts.map +1 -0
- package/dist/core/config/sdk-config.js +9 -0
- package/dist/core/config/sdk-config.js.map +1 -0
- package/dist/core/context/execution.d.ts +35 -0
- package/dist/core/context/execution.d.ts.map +1 -0
- package/dist/core/context/execution.js +55 -0
- package/dist/core/context/execution.js.map +1 -0
- package/dist/core/errors/authentication.d.ts +13 -0
- package/dist/core/errors/authentication.d.ts.map +1 -0
- package/dist/core/errors/authentication.js +19 -0
- package/dist/core/errors/authentication.js.map +1 -0
- package/dist/core/errors/authorization.d.ts +13 -0
- package/dist/core/errors/authorization.d.ts.map +1 -0
- package/dist/core/errors/authorization.js +19 -0
- package/dist/core/errors/authorization.js.map +1 -0
- package/dist/core/errors/base.d.ts +41 -0
- package/dist/core/errors/base.d.ts.map +1 -0
- package/dist/core/errors/base.js +37 -0
- package/dist/core/errors/base.js.map +1 -0
- package/dist/core/errors/constants.d.ts +57 -0
- package/dist/core/errors/constants.d.ts.map +1 -0
- package/dist/core/errors/constants.js +66 -0
- package/dist/core/errors/constants.js.map +1 -0
- package/dist/core/errors/error-factory.d.ts +17 -0
- package/dist/core/errors/error-factory.d.ts.map +1 -0
- package/dist/core/errors/error-factory.js +57 -0
- package/dist/core/errors/error-factory.js.map +1 -0
- package/dist/core/errors/guards.d.ts +48 -0
- package/dist/core/errors/guards.d.ts.map +1 -0
- package/dist/core/errors/guards.js +76 -0
- package/dist/core/errors/guards.js.map +1 -0
- package/dist/core/errors/index.d.ts +11 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/errors/index.js +15 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/core/errors/network.d.ts +14 -0
- package/dist/core/errors/network.d.ts.map +1 -0
- package/dist/core/errors/network.js +20 -0
- package/dist/core/errors/network.js.map +1 -0
- package/dist/core/errors/not-found.d.ts +13 -0
- package/dist/core/errors/not-found.d.ts.map +1 -0
- package/dist/core/errors/not-found.js +19 -0
- package/dist/core/errors/not-found.js.map +1 -0
- package/dist/core/errors/parser.d.ts +29 -0
- package/dist/core/errors/parser.d.ts.map +1 -0
- package/dist/core/errors/parser.js +152 -0
- package/dist/core/errors/parser.js.map +1 -0
- package/dist/core/errors/rate-limit.d.ts +12 -0
- package/dist/core/errors/rate-limit.d.ts.map +1 -0
- package/dist/core/errors/rate-limit.js +18 -0
- package/dist/core/errors/rate-limit.js.map +1 -0
- package/dist/core/errors/server.d.ts +17 -0
- package/dist/core/errors/server.d.ts.map +1 -0
- package/dist/core/errors/server.js +27 -0
- package/dist/core/errors/server.js.map +1 -0
- package/dist/core/errors/types.d.ts +94 -0
- package/dist/core/errors/types.d.ts.map +1 -0
- package/dist/core/errors/types.js +28 -0
- package/dist/core/errors/types.js.map +1 -0
- package/dist/core/errors/validation.d.ts +13 -0
- package/dist/core/errors/validation.d.ts.map +1 -0
- package/dist/core/errors/validation.js +19 -0
- package/dist/core/errors/validation.js.map +1 -0
- package/dist/core/http/api-client.d.ts +30 -0
- package/dist/core/http/api-client.d.ts.map +1 -0
- package/dist/core/http/api-client.js +131 -0
- package/dist/core/http/api-client.js.map +1 -0
- package/dist/core/telemetry/client.d.ts +34 -0
- package/dist/core/telemetry/client.d.ts.map +1 -0
- package/dist/core/telemetry/client.js +189 -0
- package/dist/core/telemetry/client.js.map +1 -0
- package/dist/core/telemetry/constants.d.ts +19 -0
- package/dist/core/telemetry/constants.d.ts.map +1 -0
- package/dist/core/telemetry/constants.js +24 -0
- package/dist/core/telemetry/constants.js.map +1 -0
- package/dist/core/telemetry/index.d.ts +7 -0
- package/dist/core/telemetry/index.d.ts.map +1 -0
- package/dist/core/telemetry/index.js +7 -0
- package/dist/core/telemetry/index.js.map +1 -0
- package/dist/core/telemetry/track.d.ts +26 -0
- package/dist/core/telemetry/track.d.ts.map +1 -0
- package/dist/core/telemetry/track.js +67 -0
- package/dist/core/telemetry/track.js.map +1 -0
- package/dist/core/telemetry/types.d.ts +18 -0
- package/dist/core/telemetry/types.d.ts.map +1 -0
- package/dist/core/telemetry/types.js +5 -0
- package/dist/core/telemetry/types.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/models/action-center/index.d.ts +3 -0
- package/dist/models/action-center/index.d.ts.map +1 -0
- package/dist/models/action-center/index.js +3 -0
- package/dist/models/action-center/index.js.map +1 -0
- package/dist/models/action-center/tasks.constants.d.ts +12 -0
- package/dist/models/action-center/tasks.constants.d.ts.map +1 -0
- package/dist/models/action-center/tasks.constants.js +18 -0
- package/dist/models/action-center/tasks.constants.js.map +1 -0
- package/dist/models/action-center/tasks.internal-types.d.ts +13 -0
- package/dist/models/action-center/tasks.internal-types.d.ts.map +1 -0
- package/dist/models/action-center/tasks.internal-types.js +2 -0
- package/dist/models/action-center/tasks.internal-types.js.map +1 -0
- package/dist/models/action-center/tasks.models.d.ts +79 -0
- package/dist/models/action-center/tasks.models.d.ts.map +1 -0
- package/dist/models/action-center/tasks.models.js +60 -0
- package/dist/models/action-center/tasks.models.js.map +1 -0
- package/dist/models/action-center/tasks.types.d.ts +180 -0
- package/dist/models/action-center/tasks.types.d.ts.map +1 -0
- package/dist/models/action-center/tasks.types.js +40 -0
- package/dist/models/action-center/tasks.types.js.map +1 -0
- package/dist/models/common/index.d.ts +3 -0
- package/dist/models/common/index.d.ts.map +1 -0
- package/dist/models/common/index.js +3 -0
- package/dist/models/common/index.js.map +1 -0
- package/dist/models/common/request-spec.d.ts +89 -0
- package/dist/models/common/request-spec.d.ts.map +1 -0
- package/dist/models/common/request-spec.js +2 -0
- package/dist/models/common/request-spec.js.map +1 -0
- package/dist/models/common/types.d.ts +43 -0
- package/dist/models/common/types.d.ts.map +1 -0
- package/dist/models/common/types.js +16 -0
- package/dist/models/common/types.js.map +1 -0
- package/dist/models/data-fabric/entities.constants.d.ts +32 -0
- package/dist/models/data-fabric/entities.constants.d.ts.map +1 -0
- package/dist/models/data-fabric/entities.constants.js +46 -0
- package/dist/models/data-fabric/entities.constants.js.map +1 -0
- package/dist/models/data-fabric/entities.internal-types.d.ts +12 -0
- package/dist/models/data-fabric/entities.internal-types.d.ts.map +1 -0
- package/dist/models/data-fabric/entities.internal-types.js +2 -0
- package/dist/models/data-fabric/entities.internal-types.js.map +1 -0
- package/dist/models/data-fabric/entities.models.d.ts +213 -0
- package/dist/models/data-fabric/entities.models.d.ts.map +1 -0
- package/dist/models/data-fabric/entities.models.js +43 -0
- package/dist/models/data-fabric/entities.models.js.map +1 -0
- package/dist/models/data-fabric/entities.types.d.ts +264 -0
- package/dist/models/data-fabric/entities.types.d.ts.map +1 -0
- package/dist/models/data-fabric/entities.types.js +63 -0
- package/dist/models/data-fabric/entities.types.js.map +1 -0
- package/dist/models/data-fabric/index.d.ts +3 -0
- package/dist/models/data-fabric/index.d.ts.map +1 -0
- package/dist/models/data-fabric/index.js +3 -0
- package/dist/models/data-fabric/index.js.map +1 -0
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +11 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/maestro/index.d.ts +5 -0
- package/dist/models/maestro/index.d.ts.map +1 -0
- package/dist/models/maestro/index.js +8 -0
- package/dist/models/maestro/index.js.map +1 -0
- package/dist/models/maestro/process-instances.constants.d.ts +13 -0
- package/dist/models/maestro/process-instances.constants.d.ts.map +1 -0
- package/dist/models/maestro/process-instances.constants.js +17 -0
- package/dist/models/maestro/process-instances.constants.js.map +1 -0
- package/dist/models/maestro/process-instances.models.d.ts +210 -0
- package/dist/models/maestro/process-instances.models.d.ts.map +1 -0
- package/dist/models/maestro/process-instances.models.js +38 -0
- package/dist/models/maestro/process-instances.models.js.map +1 -0
- package/dist/models/maestro/process-instances.types.d.ts +78 -0
- package/dist/models/maestro/process-instances.types.d.ts.map +1 -0
- package/dist/models/maestro/process-instances.types.js +6 -0
- package/dist/models/maestro/process-instances.types.js.map +1 -0
- package/dist/models/maestro/processes.models.d.ts +31 -0
- package/dist/models/maestro/processes.models.d.ts.map +1 -0
- package/dist/models/maestro/processes.models.js +6 -0
- package/dist/models/maestro/processes.models.js.map +1 -0
- package/dist/models/maestro/processes.types.d.ts +42 -0
- package/dist/models/maestro/processes.types.d.ts.map +1 -0
- package/dist/models/maestro/processes.types.js +6 -0
- package/dist/models/maestro/processes.types.js.map +1 -0
- package/dist/models/orchestrator/assets.constants.d.ts +7 -0
- package/dist/models/orchestrator/assets.constants.d.ts.map +1 -0
- package/dist/models/orchestrator/assets.constants.js +8 -0
- package/dist/models/orchestrator/assets.constants.js.map +1 -0
- package/dist/models/orchestrator/assets.models.d.ts +55 -0
- package/dist/models/orchestrator/assets.models.d.ts.map +1 -0
- package/dist/models/orchestrator/assets.models.js +2 -0
- package/dist/models/orchestrator/assets.models.js.map +1 -0
- package/dist/models/orchestrator/assets.types.d.ts +65 -0
- package/dist/models/orchestrator/assets.types.d.ts.map +1 -0
- package/dist/models/orchestrator/assets.types.js +24 -0
- package/dist/models/orchestrator/assets.types.js.map +1 -0
- package/dist/models/orchestrator/buckets.constants.d.ts +7 -0
- package/dist/models/orchestrator/buckets.constants.d.ts.map +1 -0
- package/dist/models/orchestrator/buckets.constants.js +9 -0
- package/dist/models/orchestrator/buckets.constants.js.map +1 -0
- package/dist/models/orchestrator/buckets.models.d.ts +144 -0
- package/dist/models/orchestrator/buckets.models.d.ts.map +1 -0
- package/dist/models/orchestrator/buckets.models.js +2 -0
- package/dist/models/orchestrator/buckets.models.js.map +1 -0
- package/dist/models/orchestrator/buckets.types.d.ts +176 -0
- package/dist/models/orchestrator/buckets.types.d.ts.map +1 -0
- package/dist/models/orchestrator/buckets.types.js +8 -0
- package/dist/models/orchestrator/buckets.types.js.map +1 -0
- package/dist/models/orchestrator/index.d.ts +9 -0
- package/dist/models/orchestrator/index.d.ts.map +1 -0
- package/dist/models/orchestrator/index.js +13 -0
- package/dist/models/orchestrator/index.js.map +1 -0
- package/dist/models/orchestrator/processes.constants.d.ts +7 -0
- package/dist/models/orchestrator/processes.constants.d.ts.map +1 -0
- package/dist/models/orchestrator/processes.constants.js +17 -0
- package/dist/models/orchestrator/processes.constants.js.map +1 -0
- package/dist/models/orchestrator/processes.models.d.ts +87 -0
- package/dist/models/orchestrator/processes.models.d.ts.map +1 -0
- package/dist/models/orchestrator/processes.models.js +2 -0
- package/dist/models/orchestrator/processes.models.js.map +1 -0
- package/dist/models/orchestrator/processes.types.d.ts +293 -0
- package/dist/models/orchestrator/processes.types.d.ts.map +1 -0
- package/dist/models/orchestrator/processes.types.js +110 -0
- package/dist/models/orchestrator/processes.types.js.map +1 -0
- package/dist/models/orchestrator/queues.constants.d.ts +7 -0
- package/dist/models/orchestrator/queues.constants.d.ts.map +1 -0
- package/dist/models/orchestrator/queues.constants.js +9 -0
- package/dist/models/orchestrator/queues.constants.js.map +1 -0
- package/dist/models/orchestrator/queues.models.d.ts +61 -0
- package/dist/models/orchestrator/queues.models.d.ts.map +1 -0
- package/dist/models/orchestrator/queues.models.js +2 -0
- package/dist/models/orchestrator/queues.models.js.map +1 -0
- package/dist/models/orchestrator/queues.types.d.ts +39 -0
- package/dist/models/orchestrator/queues.types.d.ts.map +1 -0
- package/dist/models/orchestrator/queues.types.js +2 -0
- package/dist/models/orchestrator/queues.types.js.map +1 -0
- package/dist/services/action-center/index.d.ts +2 -0
- package/dist/services/action-center/index.d.ts.map +1 -0
- package/dist/services/action-center/index.js +2 -0
- package/dist/services/action-center/index.js.map +1 -0
- package/dist/services/action-center/tasks.d.ts +254 -0
- package/dist/services/action-center/tasks.d.ts.map +1 -0
- package/dist/services/action-center/tasks.js +446 -0
- package/dist/services/action-center/tasks.js.map +1 -0
- package/dist/services/base.d.ts +49 -0
- package/dist/services/base.d.ts.map +1 -0
- package/dist/services/base.js +183 -0
- package/dist/services/base.js.map +1 -0
- package/dist/services/data-fabric/entities.d.ts +180 -0
- package/dist/services/data-fabric/entities.d.ts.map +1 -0
- package/dist/services/data-fabric/entities.js +326 -0
- package/dist/services/data-fabric/entities.js.map +1 -0
- package/dist/services/data-fabric/index.d.ts +2 -0
- package/dist/services/data-fabric/index.d.ts.map +1 -0
- package/dist/services/data-fabric/index.js +2 -0
- package/dist/services/data-fabric/index.js.map +1 -0
- package/dist/services/folder-scoped.d.ts +21 -0
- package/dist/services/folder-scoped.d.ts.map +1 -0
- package/dist/services/folder-scoped.js +36 -0
- package/dist/services/folder-scoped.js.map +1 -0
- package/dist/services/index.d.ts +6 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +6 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/maestro/index.d.ts +3 -0
- package/dist/services/maestro/index.d.ts.map +1 -0
- package/dist/services/maestro/index.js +3 -0
- package/dist/services/maestro/index.js.map +1 -0
- package/dist/services/maestro/maestro-processes.d.ts +35 -0
- package/dist/services/maestro/maestro-processes.d.ts.map +1 -0
- package/dist/services/maestro/maestro-processes.js +47 -0
- package/dist/services/maestro/maestro-processes.js.map +1 -0
- package/dist/services/maestro/process-instances.d.ts +96 -0
- package/dist/services/maestro/process-instances.d.ts.map +1 -0
- package/dist/services/maestro/process-instances.js +190 -0
- package/dist/services/maestro/process-instances.js.map +1 -0
- package/dist/services/orchestrator/assets.d.ts +63 -0
- package/dist/services/orchestrator/assets.d.ts.map +1 -0
- package/dist/services/orchestrator/assets.js +110 -0
- package/dist/services/orchestrator/assets.js.map +1 -0
- package/dist/services/orchestrator/buckets.d.ts +186 -0
- package/dist/services/orchestrator/buckets.d.ts.map +1 -0
- package/dist/services/orchestrator/buckets.js +436 -0
- package/dist/services/orchestrator/buckets.js.map +1 -0
- package/dist/services/orchestrator/index.d.ts +5 -0
- package/dist/services/orchestrator/index.d.ts.map +1 -0
- package/dist/services/orchestrator/index.js +5 -0
- package/dist/services/orchestrator/index.js.map +1 -0
- package/dist/services/orchestrator/processes.d.ts +96 -0
- package/dist/services/orchestrator/processes.d.ts.map +1 -0
- package/dist/services/orchestrator/processes.js +172 -0
- package/dist/services/orchestrator/processes.js.map +1 -0
- package/dist/services/orchestrator/queues.d.ts +72 -0
- package/dist/services/orchestrator/queues.d.ts.map +1 -0
- package/dist/services/orchestrator/queues.js +117 -0
- package/dist/services/orchestrator/queues.js.map +1 -0
- package/dist/uipath.d.ts +65 -0
- package/dist/uipath.d.ts.map +1 -0
- package/dist/uipath.js +146 -0
- package/dist/uipath.js.map +1 -0
- package/dist/utils/constants/common.d.ts +84 -0
- package/dist/utils/constants/common.d.ts.map +1 -0
- package/dist/utils/constants/common.js +84 -0
- package/dist/utils/constants/common.js.map +1 -0
- package/dist/utils/constants/endpoints.d.ts +96 -0
- package/dist/utils/constants/endpoints.d.ts.map +1 -0
- package/dist/utils/constants/endpoints.js +96 -0
- package/dist/utils/constants/endpoints.js.map +1 -0
- package/dist/utils/constants/headers.d.ts +27 -0
- package/dist/utils/constants/headers.d.ts.map +1 -0
- package/dist/utils/constants/headers.js +27 -0
- package/dist/utils/constants/headers.js.map +1 -0
- package/dist/utils/http/headers.d.ts +37 -0
- package/dist/utils/http/headers.d.ts.map +1 -0
- package/dist/utils/http/headers.js +51 -0
- package/dist/utils/http/headers.js.map +1 -0
- package/dist/utils/http/params.d.ts +27 -0
- package/dist/utils/http/params.d.ts.map +1 -0
- package/dist/utils/http/params.js +35 -0
- package/dist/utils/http/params.js.map +1 -0
- package/dist/utils/object.d.ts +32 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/object.js +50 -0
- package/dist/utils/object.js.map +1 -0
- package/dist/utils/pagination/constants.d.ts +18 -0
- package/dist/utils/pagination/constants.d.ts.map +1 -0
- package/dist/utils/pagination/constants.js +23 -0
- package/dist/utils/pagination/constants.js.map +1 -0
- package/dist/utils/pagination/helpers.d.ts +62 -0
- package/dist/utils/pagination/helpers.d.ts.map +1 -0
- package/dist/utils/pagination/helpers.js +254 -0
- package/dist/utils/pagination/helpers.js.map +1 -0
- package/dist/utils/pagination/index.d.ts +3 -0
- package/dist/utils/pagination/index.d.ts.map +1 -0
- package/dist/utils/pagination/index.js +3 -0
- package/dist/utils/pagination/index.js.map +1 -0
- package/dist/utils/pagination/internal-types.d.ts +184 -0
- package/dist/utils/pagination/internal-types.d.ts.map +1 -0
- package/dist/utils/pagination/internal-types.js +9 -0
- package/dist/utils/pagination/internal-types.js.map +1 -0
- package/dist/utils/pagination/pagination-manager.d.ts +17 -0
- package/dist/utils/pagination/pagination-manager.d.ts.map +1 -0
- package/dist/utils/pagination/pagination-manager.js +76 -0
- package/dist/utils/pagination/pagination-manager.js.map +1 -0
- package/dist/utils/pagination/types.d.ts +68 -0
- package/dist/utils/pagination/types.d.ts.map +1 -0
- package/dist/utils/pagination/types.js +2 -0
- package/dist/utils/pagination/types.js.map +1 -0
- package/dist/utils/platform.d.ts +8 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +8 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/transform.d.ts +240 -0
- package/dist/utils/transform.d.ts.map +1 -0
- package/dist/utils/transform.js +334 -0
- package/dist/utils/transform.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright 2025 UiPath
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/Readme.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# UiPath TypeScript SDK
|
|
2
|
+
|
|
3
|
+
[View Full API Reference ↗](https://uipath.github.io/uipath-typescript/getting-started/)
|
|
4
|
+
|
|
5
|
+
A comprehensive TypeScript SDK for interacting with UiPath Platform services.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @uipath/uipath-typescript
|
|
11
|
+
# or
|
|
12
|
+
yarn add @uipath/uipath-typescript
|
|
13
|
+
# or
|
|
14
|
+
pnpm add @uipath/uipath-typescript
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { UiPath } from '@uipath/uipath-typescript';
|
|
22
|
+
|
|
23
|
+
// Initialize the SDK
|
|
24
|
+
const sdk = new UiPath({
|
|
25
|
+
baseUrl: 'https://cloud.uipath.com',
|
|
26
|
+
orgName: 'your-organization',
|
|
27
|
+
tenantName: 'your-tenant',
|
|
28
|
+
secret: 'your-secret' //PAT Token or Bearer Token
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Use the services
|
|
32
|
+
const processes = await sdk.maestro.processes.getAll();
|
|
33
|
+
const tasks = await sdk.tasks.getAll();
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Authentication
|
|
37
|
+
|
|
38
|
+
The SDK supports two authentication methods:
|
|
39
|
+
|
|
40
|
+
### 1. Secret-based Authentication
|
|
41
|
+
```typescript
|
|
42
|
+
const sdk = new UiPath({
|
|
43
|
+
baseUrl: 'https://cloud.uipath.com',
|
|
44
|
+
orgName: 'your-organization',
|
|
45
|
+
tenantName: 'your-tenant',
|
|
46
|
+
secret: 'your-secret' //PAT Token or Bearer Token
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For OAuth, first create a non confidential [External App](https://docs.uipath.com/automation-cloud/automation-cloud/latest/admin-guide/managing-external-applications) with the required scopes and provide the clientId, redirectUri, and scope here.
|
|
51
|
+
|
|
52
|
+
### 2. OAuth Authentication
|
|
53
|
+
```typescript
|
|
54
|
+
const sdk = new UiPath({
|
|
55
|
+
baseUrl: 'https://cloud.uipath.com',
|
|
56
|
+
orgName: 'your-organization',
|
|
57
|
+
tenantName: 'your-tenant',
|
|
58
|
+
clientId: 'your-client-id',
|
|
59
|
+
redirectUri: 'your-redirect-uri',
|
|
60
|
+
scope: 'your-scopes'
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// IMPORTANT: OAuth requires calling initialize()
|
|
64
|
+
await sdk.initialize();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## SDK Initialization - The initialize() Method
|
|
68
|
+
|
|
69
|
+
### When to Use initialize()
|
|
70
|
+
|
|
71
|
+
The `initialize()` method completes the authentication process for the SDK:
|
|
72
|
+
|
|
73
|
+
- **Secret Authentication**: Auto-initializes when creating the SDK instance - **no need to call initialize()**
|
|
74
|
+
- **OAuth Authentication**: **MUST call** `await sdk.initialize()` before using any SDK services
|
|
75
|
+
|
|
76
|
+
### Example: Secret Authentication (Auto-initialized)
|
|
77
|
+
```typescript
|
|
78
|
+
const sdk = new UiPath({
|
|
79
|
+
baseUrl: 'https://cloud.uipath.com',
|
|
80
|
+
orgName: 'your-organization',
|
|
81
|
+
tenantName: 'your-tenant',
|
|
82
|
+
secret: 'your-secret' //PAT Token or Bearer Token
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Ready to use immediately - no initialize() needed
|
|
86
|
+
const tasks = await sdk.tasks.getAll();
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Example: OAuth Authentication (Requires initialize)
|
|
90
|
+
```typescript
|
|
91
|
+
const sdk = new UiPath({
|
|
92
|
+
baseUrl: 'https://cloud.uipath.com',
|
|
93
|
+
orgName: 'your-organization',
|
|
94
|
+
tenantName: 'your-tenant',
|
|
95
|
+
clientId: 'your-client-id',
|
|
96
|
+
redirectUri: 'http://localhost:3000',
|
|
97
|
+
scope: 'your-scopes'
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Must initialize before using services
|
|
101
|
+
try {
|
|
102
|
+
await sdk.initialize();
|
|
103
|
+
console.log('SDK initialized successfully');
|
|
104
|
+
|
|
105
|
+
// Now you can use the SDK
|
|
106
|
+
const tasks = await sdk.tasks.getAll();
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error('Failed to initialize SDK:', error);
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Available Services
|
|
113
|
+
|
|
114
|
+
The SDK provides access to the following services through a consistent API:
|
|
115
|
+
|
|
116
|
+
- `sdk.maestro.processes` - Manage agentic maestro processes
|
|
117
|
+
- `sdk.maestro.processes.instances` - Manage maestro process executions
|
|
118
|
+
- `sdk.tasks` - Create and manage tasks
|
|
119
|
+
- `sdk.entities` - Data Fabric entity operations
|
|
120
|
+
- `sdk.processes` - Manage Orchestrator processes
|
|
121
|
+
- `sdk.buckets` - Manage storage buckets in Orchestrator
|
|
122
|
+
- `sdk.queues` - Manage Orchestrator queues
|
|
123
|
+
- `sdk.assets` - Manage Orchestrator assets
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
**Example usage**:
|
|
127
|
+
```typescript
|
|
128
|
+
// Get all processes
|
|
129
|
+
const bpmnProcesses = await sdk.maestro.processes.getAll();
|
|
130
|
+
|
|
131
|
+
// Get a specific task
|
|
132
|
+
const task = await sdk.tasks.getById('task-id');
|
|
133
|
+
|
|
134
|
+
// Create a new entity
|
|
135
|
+
const entity = await sdk.entities.create({...});
|
|
136
|
+
|
|
137
|
+
// Get all buckets
|
|
138
|
+
const buckets = await sdk.buckets.getAll();
|
|
139
|
+
|
|
140
|
+
// Get a specific process and start it
|
|
141
|
+
const process = await sdk.processes.getAll({
|
|
142
|
+
filter: "name eq 'MyProcess'"
|
|
143
|
+
});
|
|
144
|
+
const job = await sdk.processes.start({
|
|
145
|
+
processKey: process[0].key
|
|
146
|
+
}, 'folder-id');
|
|
147
|
+
|
|
148
|
+
// Get all queues
|
|
149
|
+
const queues = await sdk.queues.getAll();
|
|
150
|
+
|
|
151
|
+
// Get all assets
|
|
152
|
+
const assets = await sdk.assets.getAll();
|
|
153
|
+
//Get assets in a folder
|
|
154
|
+
const assets = await sdk.assets.getAll({folderId: 'folder-id'});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## TypeScript Support
|
|
158
|
+
|
|
159
|
+
The SDK is fully typed and exports all types for better developer experience and LLM-friendly coding:
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
import {
|
|
163
|
+
UiPath,
|
|
164
|
+
// Task types
|
|
165
|
+
TaskCreateOptions,
|
|
166
|
+
TaskPriority,
|
|
167
|
+
TaskStatus,
|
|
168
|
+
|
|
169
|
+
// Process types
|
|
170
|
+
ProcessStartRequest,
|
|
171
|
+
ProcessStartResponse,
|
|
172
|
+
ProcessGetResponse,
|
|
173
|
+
|
|
174
|
+
// Entity types
|
|
175
|
+
EntityGetResponse,
|
|
176
|
+
EntityInsertOptions,
|
|
177
|
+
|
|
178
|
+
// Asset/Queue/Bucket types
|
|
179
|
+
AssetGetResponse,
|
|
180
|
+
QueueGetResponse,
|
|
181
|
+
BucketGetResponse,
|
|
182
|
+
|
|
183
|
+
// Maestro types
|
|
184
|
+
ProcessInstanceGetResponse,
|
|
185
|
+
MaestroProcessGetAllResponse
|
|
186
|
+
} from '@uipath/uipath-typescript';
|
|
187
|
+
|
|
188
|
+
// TypeScript will provide full intellisense
|
|
189
|
+
const taskOptions: TaskCreateOptions = {
|
|
190
|
+
title: 'Review Document',
|
|
191
|
+
priority: TaskPriority.High
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const task = await sdk.tasks.create(taskOptions);
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Error Handling
|
|
198
|
+
|
|
199
|
+
The SDK provides comprehensive error handling with typed errors:
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
import { UiPathError } from '@uipath/uipath-typescript';
|
|
203
|
+
|
|
204
|
+
try {
|
|
205
|
+
const process = await sdk.maestro.processes.getById('invalid-id');
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if (error instanceof UiPathError) {
|
|
208
|
+
// Access common error properties
|
|
209
|
+
console.log('Error Type:', error.type);
|
|
210
|
+
console.log('Message:', error.message);
|
|
211
|
+
console.log('Status Code:', error.statusCode);
|
|
212
|
+
console.log('Request ID:', error.requestId);
|
|
213
|
+
console.log('Timestamp:', error.timestamp);
|
|
214
|
+
console.log('error stack trace:', error.stack);
|
|
215
|
+
|
|
216
|
+
// Get detailed debug information including stack trace
|
|
217
|
+
const debugInfo = error.getDebugInfo();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Pagination
|
|
223
|
+
|
|
224
|
+
The SDK provides built-in pagination support:
|
|
225
|
+
|
|
226
|
+
### Cursor-based Navigation
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
// Navigate through pages using cursors
|
|
230
|
+
let currentPage = await sdk.assets.getAll({ pageSize: 10 }) as PaginatedResponse<AssetGetResponse>;
|
|
231
|
+
|
|
232
|
+
while (currentPage.hasNextPage) {
|
|
233
|
+
// Process current page items
|
|
234
|
+
currentPage.items.forEach(item => console.log(item.name));
|
|
235
|
+
|
|
236
|
+
// Get next page using cursor
|
|
237
|
+
currentPage = await sdk.assets.getAll({
|
|
238
|
+
cursor: currentPage.nextCursor
|
|
239
|
+
}) as PaginatedResponse<AssetGetResponse>;
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Page Jumping
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
// Jump directly to page 5 (when supported)
|
|
247
|
+
const page5 = await sdk.assets.getAll({
|
|
248
|
+
jumpToPage: 5,
|
|
249
|
+
pageSize: 20
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// Check if page jumping is supported
|
|
253
|
+
if (page5.supportsPageJump) {
|
|
254
|
+
console.log(`Currently on page ${page5.currentPage} of ${page5.totalPages}`);
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Development
|
|
259
|
+
|
|
260
|
+
Before submitting a pull request, please review our [Contribution Guidelines](https://uipath.github.io/uipath-typescript/CONTRIBUTING/).
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { BaseService } from '../../services/base';
|
|
2
|
+
import { Config } from '../config/config';
|
|
3
|
+
import { ExecutionContext } from '../context/execution';
|
|
4
|
+
import { TokenManager } from './token-manager';
|
|
5
|
+
import { TokenInfo } from './types';
|
|
6
|
+
export declare class AuthService extends BaseService {
|
|
7
|
+
private tokenManager;
|
|
8
|
+
constructor(config: Config, executionContext: ExecutionContext);
|
|
9
|
+
/**
|
|
10
|
+
* Get the token manager instance
|
|
11
|
+
*/
|
|
12
|
+
getTokenManager(): TokenManager;
|
|
13
|
+
/**
|
|
14
|
+
* Authenticates the user based on the provided SDK configuration.
|
|
15
|
+
* This method handles OAuth 2.0 authentication flow only.
|
|
16
|
+
* For secret-based authentication, see authenticateWithSecret().
|
|
17
|
+
* @param config The SDK configuration object.
|
|
18
|
+
* @returns A promise that resolves to true if authentication is successful, otherwise false.
|
|
19
|
+
* In an OAuth flow, this method will trigger a page redirect and the promise will not resolve.
|
|
20
|
+
*/
|
|
21
|
+
authenticate(config: Config): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Authenticate using OAuth flow
|
|
24
|
+
*/
|
|
25
|
+
private _authenticateWithOAuth;
|
|
26
|
+
/**
|
|
27
|
+
* Authenticate using API secret
|
|
28
|
+
*/
|
|
29
|
+
authenticateWithSecret(secret: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Updates the access token used for API requests
|
|
32
|
+
* @param tokenInfo The token information containing the access token, type, expiration, and refresh token
|
|
33
|
+
*/
|
|
34
|
+
updateToken(tokenInfo: TokenInfo): void;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if the current token is valid
|
|
37
|
+
*/
|
|
38
|
+
hasValidToken(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get the current token
|
|
41
|
+
*/
|
|
42
|
+
getToken(): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Generates a random code verifier for PKCE
|
|
45
|
+
*/
|
|
46
|
+
generateCodeVerifier(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Generates a code challenge from the code verifier
|
|
49
|
+
*/
|
|
50
|
+
generateCodeChallenge(codeVerifier: string): Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the authorization URL for the OAuth flow
|
|
53
|
+
*/
|
|
54
|
+
getAuthorizationUrl(params: {
|
|
55
|
+
clientId: string;
|
|
56
|
+
redirectUri: string;
|
|
57
|
+
codeChallenge: string;
|
|
58
|
+
scope: string;
|
|
59
|
+
state?: string;
|
|
60
|
+
}): string;
|
|
61
|
+
/**
|
|
62
|
+
* Exchanges the authorization code for an access token and automatically updates the current token
|
|
63
|
+
*/
|
|
64
|
+
private _getAccessToken;
|
|
65
|
+
/**
|
|
66
|
+
* Base64URL encodes an array buffer
|
|
67
|
+
*/
|
|
68
|
+
private _base64URLEncode;
|
|
69
|
+
private _initiateOAuthFlow;
|
|
70
|
+
private _handleOAuthCallback;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/core/auth/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAa,SAAS,EAAE,MAAM,SAAS,CAAC;AAK/C,qBAAa,WAAY,SAAQ,WAAW;IAC1C,OAAO,CAAC,YAAY,CAAe;gBAEvB,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB;IAO9D;;OAEG;IACI,eAAe,IAAI,YAAY;IAItC;;;;;;;OAOG;IACU,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkB3D;;OAEG;YACW,sBAAsB;IA0CpC;;OAEG;IACI,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAUtD;;;OAGG;IACH,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAIvC;;OAEG;IACI,aAAa,IAAI,OAAO;IAI/B;;OAEG;IACI,QAAQ,IAAI,MAAM,GAAG,SAAS;IAOrC;;OAEG;IACH,oBAAoB,IAAI,MAAM;IAgB9B;;OAEG;IACG,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAkBlE;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE;QAC1B,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,MAAM;IAgBV;;OAEG;YACW,eAAe;IAyC7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;YAQV,kBAAkB;YAgBlB,oBAAoB;CAmBnC"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { BaseService } from '../../services/base';
|
|
2
|
+
import { TokenManager } from './token-manager';
|
|
3
|
+
import { hasOAuthConfig } from '../config/sdk-config';
|
|
4
|
+
import { isBrowser } from '../../utils/platform';
|
|
5
|
+
import { IDENTITY_ENDPOINTS } from '../../utils/constants/endpoints';
|
|
6
|
+
export class AuthService extends BaseService {
|
|
7
|
+
constructor(config, executionContext) {
|
|
8
|
+
const isOAuth = hasOAuthConfig(config);
|
|
9
|
+
const tokenManager = new TokenManager(executionContext, config, isOAuth);
|
|
10
|
+
super(config, executionContext, tokenManager);
|
|
11
|
+
this.tokenManager = tokenManager;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get the token manager instance
|
|
15
|
+
*/
|
|
16
|
+
getTokenManager() {
|
|
17
|
+
return this.tokenManager;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Authenticates the user based on the provided SDK configuration.
|
|
21
|
+
* This method handles OAuth 2.0 authentication flow only.
|
|
22
|
+
* For secret-based authentication, see authenticateWithSecret().
|
|
23
|
+
* @param config The SDK configuration object.
|
|
24
|
+
* @returns A promise that resolves to true if authentication is successful, otherwise false.
|
|
25
|
+
* In an OAuth flow, this method will trigger a page redirect and the promise will not resolve.
|
|
26
|
+
*/
|
|
27
|
+
async authenticate(config) {
|
|
28
|
+
// Try to load token from storage first (only works for OAuth tokens)
|
|
29
|
+
const loadedFromStorage = this.tokenManager.loadFromStorage();
|
|
30
|
+
// If we have a valid token from storage, return true
|
|
31
|
+
if (loadedFromStorage && this.tokenManager.hasValidToken()) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
// If we don't have a valid token from storage, authenticate with OAuth
|
|
35
|
+
if (hasOAuthConfig(config)) {
|
|
36
|
+
return await this._authenticateWithOAuth(config.clientId, config.redirectUri, config.scope);
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Authenticate using OAuth flow
|
|
42
|
+
*/
|
|
43
|
+
async _authenticateWithOAuth(clientId, redirectUri, scope) {
|
|
44
|
+
if (!isBrowser) {
|
|
45
|
+
throw new Error('OAuth flow is only supported in browser environments');
|
|
46
|
+
}
|
|
47
|
+
// Check if we have a stored code verifier indicating we're in an OAuth flow
|
|
48
|
+
const codeVerifier = sessionStorage.getItem('uipath_sdk_code_verifier');
|
|
49
|
+
const isInOAuthFlow = codeVerifier !== null;
|
|
50
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
51
|
+
const code = urlParams.get('code');
|
|
52
|
+
// If we're in an OAuth flow (server-controlled code verifier exists), handle the callback
|
|
53
|
+
if (isInOAuthFlow) {
|
|
54
|
+
// We're expecting a callback - validate parameters
|
|
55
|
+
if (!code) {
|
|
56
|
+
// Clear stored state on error
|
|
57
|
+
sessionStorage.removeItem('uipath_sdk_code_verifier');
|
|
58
|
+
throw new Error('Authorization code missing in OAuth callback');
|
|
59
|
+
}
|
|
60
|
+
// Validate the authorization code format before using it
|
|
61
|
+
// OAuth authorization codes should be alphanumeric with some special characters
|
|
62
|
+
const codePattern = /^[A-Za-z0-9\-._~+/]+=*$/;
|
|
63
|
+
if (!codePattern.test(code)) {
|
|
64
|
+
// Clear stored state on error
|
|
65
|
+
sessionStorage.removeItem('uipath_sdk_code_verifier');
|
|
66
|
+
throw new Error('Invalid authorization code format');
|
|
67
|
+
}
|
|
68
|
+
// Authorization code is present and validated, so we can exchange it for a token.
|
|
69
|
+
await this._handleOAuthCallback(code, clientId, redirectUri);
|
|
70
|
+
return this.hasValidToken();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
// Not in an OAuth flow - initiate one
|
|
74
|
+
// Ignore any URL parameters that might be present
|
|
75
|
+
await this._initiateOAuthFlow(clientId, redirectUri, scope);
|
|
76
|
+
// This line is not expected to be reached due to redirect
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Authenticate using API secret
|
|
82
|
+
*/
|
|
83
|
+
authenticateWithSecret(secret) {
|
|
84
|
+
try {
|
|
85
|
+
this.updateToken({ token: secret, type: 'secret' });
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.error('Failed to authenticate with secret', error);
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Updates the access token used for API requests
|
|
95
|
+
* @param tokenInfo The token information containing the access token, type, expiration, and refresh token
|
|
96
|
+
*/
|
|
97
|
+
updateToken(tokenInfo) {
|
|
98
|
+
this.tokenManager.setToken(tokenInfo);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Checks if the current token is valid
|
|
102
|
+
*/
|
|
103
|
+
hasValidToken() {
|
|
104
|
+
return this.tokenManager.hasValidToken();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get the current token
|
|
108
|
+
*/
|
|
109
|
+
getToken() {
|
|
110
|
+
if (!this.tokenManager.hasValidToken()) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
return this.tokenManager.getToken();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Generates a random code verifier for PKCE
|
|
117
|
+
*/
|
|
118
|
+
generateCodeVerifier() {
|
|
119
|
+
if (isBrowser) {
|
|
120
|
+
const array = new Uint8Array(32);
|
|
121
|
+
crypto.getRandomValues(array);
|
|
122
|
+
return this._base64URLEncode(array);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// In Node.js environment
|
|
126
|
+
const crypto = require('crypto');
|
|
127
|
+
return crypto.randomBytes(32)
|
|
128
|
+
.toString('base64')
|
|
129
|
+
.replace(/\+/g, '-')
|
|
130
|
+
.replace(/\//g, '_')
|
|
131
|
+
.replace(/=/g, '');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Generates a code challenge from the code verifier
|
|
136
|
+
*/
|
|
137
|
+
async generateCodeChallenge(codeVerifier) {
|
|
138
|
+
if (isBrowser) {
|
|
139
|
+
const encoder = new TextEncoder();
|
|
140
|
+
const data = encoder.encode(codeVerifier);
|
|
141
|
+
const hash = await crypto.subtle.digest('SHA-256', data);
|
|
142
|
+
return this._base64URLEncode(new Uint8Array(hash));
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
// In Node.js environment
|
|
146
|
+
const crypto = require('crypto');
|
|
147
|
+
return crypto.createHash('sha256')
|
|
148
|
+
.update(codeVerifier)
|
|
149
|
+
.digest('base64')
|
|
150
|
+
.replace(/\+/g, '-')
|
|
151
|
+
.replace(/\//g, '_')
|
|
152
|
+
.replace(/=/g, '');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Gets the authorization URL for the OAuth flow
|
|
157
|
+
*/
|
|
158
|
+
getAuthorizationUrl(params) {
|
|
159
|
+
const orgName = this.config.orgName;
|
|
160
|
+
const queryParams = new URLSearchParams({
|
|
161
|
+
response_type: 'code',
|
|
162
|
+
client_id: params.clientId,
|
|
163
|
+
redirect_uri: params.redirectUri,
|
|
164
|
+
code_challenge: params.codeChallenge,
|
|
165
|
+
code_challenge_method: 'S256',
|
|
166
|
+
scope: params.scope + ' offline_access',
|
|
167
|
+
state: params.state || this.generateCodeVerifier().slice(0, 16)
|
|
168
|
+
});
|
|
169
|
+
return `${this.config.baseUrl}/${orgName}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Exchanges the authorization code for an access token and automatically updates the current token
|
|
173
|
+
*/
|
|
174
|
+
async _getAccessToken(params) {
|
|
175
|
+
const orgName = this.config.orgName;
|
|
176
|
+
const body = new URLSearchParams({
|
|
177
|
+
grant_type: 'authorization_code',
|
|
178
|
+
client_id: params.clientId,
|
|
179
|
+
code: params.code,
|
|
180
|
+
redirect_uri: params.redirectUri,
|
|
181
|
+
code_verifier: params.codeVerifier
|
|
182
|
+
});
|
|
183
|
+
const response = await fetch(`${this.config.baseUrl}/${orgName}/${IDENTITY_ENDPOINTS.TOKEN}`, {
|
|
184
|
+
method: 'POST',
|
|
185
|
+
headers: {
|
|
186
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
187
|
+
},
|
|
188
|
+
body: body.toString()
|
|
189
|
+
});
|
|
190
|
+
if (!response.ok) {
|
|
191
|
+
const errorData = await response.json().catch(() => ({ message: response.statusText }));
|
|
192
|
+
console.error("OAuth error:", errorData);
|
|
193
|
+
throw new Error(`Failed to get access token: ${JSON.stringify(errorData)}`);
|
|
194
|
+
}
|
|
195
|
+
const token = await response.json();
|
|
196
|
+
this.updateToken({
|
|
197
|
+
token: token.access_token,
|
|
198
|
+
type: 'oauth',
|
|
199
|
+
expiresAt: token.expires_in ? new Date(Date.now() + token.expires_in * 1000) : undefined,
|
|
200
|
+
refreshToken: token.refresh_token
|
|
201
|
+
});
|
|
202
|
+
return token;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Base64URL encodes an array buffer
|
|
206
|
+
*/
|
|
207
|
+
_base64URLEncode(buffer) {
|
|
208
|
+
const base64 = btoa(String.fromCharCode(...buffer));
|
|
209
|
+
return base64
|
|
210
|
+
.replace(/\+/g, '-')
|
|
211
|
+
.replace(/\//g, '_')
|
|
212
|
+
.replace(/=/g, '');
|
|
213
|
+
}
|
|
214
|
+
async _initiateOAuthFlow(clientId, redirectUri, scope) {
|
|
215
|
+
const codeVerifier = this.generateCodeVerifier();
|
|
216
|
+
const codeChallenge = await this.generateCodeChallenge(codeVerifier);
|
|
217
|
+
sessionStorage.setItem('uipath_sdk_code_verifier', codeVerifier);
|
|
218
|
+
const authUrl = this.getAuthorizationUrl({
|
|
219
|
+
clientId,
|
|
220
|
+
redirectUri,
|
|
221
|
+
codeChallenge,
|
|
222
|
+
scope
|
|
223
|
+
});
|
|
224
|
+
window.location.href = authUrl;
|
|
225
|
+
}
|
|
226
|
+
async _handleOAuthCallback(code, clientId, redirectUri) {
|
|
227
|
+
const codeVerifier = sessionStorage.getItem('uipath_sdk_code_verifier');
|
|
228
|
+
if (!codeVerifier) {
|
|
229
|
+
throw new Error('Code verifier not found in session storage. Authentication may have been interrupted.');
|
|
230
|
+
}
|
|
231
|
+
sessionStorage.removeItem('uipath_sdk_code_verifier');
|
|
232
|
+
await this._getAccessToken({
|
|
233
|
+
clientId,
|
|
234
|
+
redirectUri,
|
|
235
|
+
code,
|
|
236
|
+
codeVerifier
|
|
237
|
+
});
|
|
238
|
+
const url = new URL(window.location.href);
|
|
239
|
+
url.searchParams.delete('code');
|
|
240
|
+
url.searchParams.delete('state');
|
|
241
|
+
window.history.replaceState({}, '', url.toString());
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","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EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,uFAAuF,CAAC,CAAC;QAC3G,CAAC;QACD,cAAc,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;QAEtD,MAAM,IAAI,CAAC,eAAe,CAAC;YACzB,QAAQ;YACR,WAAW;YACX,IAAI;YACJ,YAAY;SACb,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAChC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ExecutionContext } from '../context/execution';
|
|
2
|
+
import { AuthToken, TokenInfo } from './types';
|
|
3
|
+
import { Config } from '../config/config';
|
|
4
|
+
/**
|
|
5
|
+
* TokenManager is responsible for managing authentication tokens.
|
|
6
|
+
* It provides token operations for a specific client ID.
|
|
7
|
+
* - For OAuth tokens: Uses session storage with client ID-based keys
|
|
8
|
+
* - For Secret tokens: Stores only in memory, allowing multiple instances
|
|
9
|
+
*/
|
|
10
|
+
export declare class TokenManager {
|
|
11
|
+
private executionContext;
|
|
12
|
+
private config;
|
|
13
|
+
private isOAuth;
|
|
14
|
+
private currentToken?;
|
|
15
|
+
private readonly STORAGE_KEY_PREFIX;
|
|
16
|
+
private refreshPromise;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new TokenManager instance
|
|
19
|
+
* @param executionContext The execution context
|
|
20
|
+
* @param config The SDK configuration
|
|
21
|
+
* @param isOAuth Whether this is an OAuth-based authentication
|
|
22
|
+
*/
|
|
23
|
+
constructor(executionContext: ExecutionContext, config: Config, isOAuth?: boolean);
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a token is expired
|
|
26
|
+
* @param tokenInfo The token info to check
|
|
27
|
+
* @returns true if the token is expired, false otherwise
|
|
28
|
+
*/
|
|
29
|
+
isTokenExpired(tokenInfo?: TokenInfo): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the storage key for this TokenManager instance
|
|
32
|
+
*/
|
|
33
|
+
private _getStorageKey;
|
|
34
|
+
/**
|
|
35
|
+
* Loads token from session storage if available
|
|
36
|
+
* @returns true if a valid token was loaded, false otherwise
|
|
37
|
+
*/
|
|
38
|
+
loadFromStorage(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Parse and validate token info from storage
|
|
41
|
+
* @param storedToken JSON string from storage
|
|
42
|
+
* @returns Valid TokenInfo or undefined if invalid
|
|
43
|
+
*/
|
|
44
|
+
private _parseTokenInfo;
|
|
45
|
+
/**
|
|
46
|
+
* Sets a new token and updates all necessary contexts
|
|
47
|
+
*/
|
|
48
|
+
setToken(tokenInfo: TokenInfo): void;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the current token information
|
|
51
|
+
*/
|
|
52
|
+
getTokenInfo(): TokenInfo | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Gets just the token string
|
|
55
|
+
*/
|
|
56
|
+
getToken(): string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Checks if we have a valid token
|
|
59
|
+
*/
|
|
60
|
+
hasValidToken(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Clears the current token
|
|
63
|
+
*/
|
|
64
|
+
clearToken(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Updates execution context with token information
|
|
67
|
+
*/
|
|
68
|
+
private _updateExecutionContext;
|
|
69
|
+
/**
|
|
70
|
+
* Refreshes the access token using the stored refresh token.
|
|
71
|
+
* This method only works for OAuth flow.
|
|
72
|
+
* Uses a lock mechanism to prevent multiple simultaneous refreshes.
|
|
73
|
+
* @returns A promise that resolves to the new AuthToken
|
|
74
|
+
* @throws Error if not in OAuth flow, refresh token is missing, or the request fails
|
|
75
|
+
*/
|
|
76
|
+
refreshAccessToken(): Promise<AuthToken>;
|
|
77
|
+
/**
|
|
78
|
+
* Internal method to perform the actual token refresh
|
|
79
|
+
*/
|
|
80
|
+
private _doRefreshToken;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=token-manager.d.ts.map
|