feat(integration-service): add Execution passthrough#557
feat(integration-service): add Execution passthrough#557maninder-uipath wants to merge 1 commit into
Conversation
| * | ||
| * @internal | ||
| */ | ||
| class Execution { |
There was a problem hiding this comment.
Convention violation: Execution must extend BaseService.
The project convention states: "Services follow the pattern: extend BaseService, call super(uiPath), use this.get() / this.post() etc." Every other HTTP service class in the repo extends BaseService — Execution is the sole exception.
The current implementation accesses SDKInternalsRegistry.get() directly to obtain both the tokenManager and config. If the class extended BaseService, it could use the already-available protected getValidAuthToken() for the token. The only remaining dependency is config.baseUrl/orgName/tenantName for URL construction, which can be captured in the constructor after super():
| class Execution { | |
| class Execution extends BaseService { | |
| private readonly execConfig: { baseUrl: string; orgName: string; tenantName: string }; | |
| constructor(instance: IUiPath) { | |
| super(instance); | |
| const { config } = SDKInternalsRegistry.get(instance); | |
| this.execConfig = config; | |
| } | |
Then replace tokenManager.getValidToken() on line 37 with this.getValidAuthToken(), and swap config.* references to this.execConfig.*. This keeps the direct registry access scoped to the config-only concern, and routes token management through the standard base-class path.
| const headers: Record<string, string> = { | ||
| Authorization: `Bearer ${token}`, | ||
| }; |
There was a problem hiding this comment.
Missing distributed-tracing headers.
ApiClient.request() generates a traceparent / x-uipath-traceparent-id header pair on every request using crypto.randomUUID(). By using raw fetch(), execute() is invisible to the platform's distributed-tracing infrastructure — a significant observability blind-spot given this is a passthrough that proxies calls into third-party connectors.
Add the trace headers alongside Authorization:
| const headers: Record<string, string> = { | |
| Authorization: `Bearer ${token}`, | |
| }; | |
| const traceId = crypto.randomUUID().replace(/-/g, ''); | |
| const spanId = crypto.randomUUID().replace(/-/g, '').slice(0, 16); | |
| const traceparentValue = `00-${traceId}-${spanId}-01`; | |
| const headers: Record<string, string> = { | |
| Authorization: `Bearer ${token}`, | |
| [TRACEPARENT]: traceparentValue, | |
| [UIPATH_TRACEPARENT_ID]: traceparentValue, | |
| }; |
TRACEPARENT and UIPATH_TRACEPARENT_ID are already exported from src/utils/constants/headers.ts.
| (deps.tokenManager as unknown as MockableTokenManager).getValidToken = vi | ||
| .fn() | ||
| .mockResolvedValue('mock-access-token'); |
There was a problem hiding this comment.
Rule violation: as unknown as cast is prohibited.
The project rule is explicit: "NEVER use as unknown as type casts." This cast exists because TokenManager's public interface doesn't include getValidToken in the MockableTokenManager shape defined in tests/utils/setup.ts, so the test works around the type by force-casting.
The root cause is that Execution bypasses BaseService and calls tokenManager.getValidToken() directly (see the service-level comment). Once Execution extends BaseService and uses this.getValidAuthToken(), the token flows through the mock ApiClient — which already has getValidToken: vi.fn().mockResolvedValue(...) in createMockApiClient() — and this entire buildDeps() workaround disappears.
Review findingsThree issues found across the new New inline comments posted
|
Adds the Integration Service Execution passthrough (execute) exposed via the @uipath/uipath-typescript/is-execution subpath. Executes arbitrary HTTP operations against a connection instance and returns the full response envelope without throwing on non-2xx. Includes unit tests and OAuth scope docs. Reuses ELEMENT_ENDPOINTS.INSTANCE.EXECUTE. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
63f72fa to
2579d90
Compare
8a85b1f to
393b74d
Compare
Summary
PR 4/4 of the Integration Service stack. Adds the Execution passthrough.
execute()via@uipath/uipath-typescript/is-execution— runs an arbitrary HTTP operation against a connection instance and returns the full response envelope without throwing on non-2xxELEMENT_ENDPOINTS.INSTANCE.EXECUTEStack
feat/is-elements— merge the lower PRs first; GitHub will retarget this tomain.🤖 Generated with Claude Code