diff --git a/src/integration-tests/EventClient.test.ts b/src/integration-tests/EventClient.test.ts index 99d5053..7e3d4e5 100644 --- a/src/integration-tests/EventClient.test.ts +++ b/src/integration-tests/EventClient.test.ts @@ -1,11 +1,11 @@ -import { expect, describe, test, jest } from "@jest/globals"; -import { orkesConductorClient, EventClient } from "../sdk"; +import { describe, expect, jest, test } from "@jest/globals"; import type { + Action, + ConnectivityTestInput, EventHandler, Tag, - ConnectivityTestInput, - Action, } from "../open-api"; +import { EventClient, orkesConductorClient } from "../sdk"; import { describeForOrkesV5 } from "./utils/customJestDescribe"; describe("EventClient", () => { @@ -531,12 +531,27 @@ describe("EventClient", () => { expect(handlerAfterEvent.active).toBe(true); expect(handlerAfterEvent.event).toEqual(eventName); - const executions = await eventClient.getEventExecutions(handlerName); - expect(Array.isArray(executions)).toBe(true); + // Wait for event execution to be created (async processing) + let ourExecution; + const maxWaitTime = 30000; // 30 seconds + const pollInterval = 500; // 500ms + const startTime = Date.now(); + + while (Date.now() - startTime < maxWaitTime) { + const executions = await eventClient.getEventExecutions(handlerName); + expect(Array.isArray(executions)).toBe(true); + + ourExecution = executions.find( + (exec) => exec.event === eventName || exec.name === handlerName + ); + + if (ourExecution) { + break; + } + + await new Promise((resolve) => setTimeout(resolve, pollInterval)); + } - const ourExecution = executions.find( - (exec) => exec.event === eventName || exec.name === handlerName - ); expect(ourExecution).toBeDefined(); if (ourExecution?.event) { expect(ourExecution.event).toEqual(eventName); @@ -638,14 +653,27 @@ describe("EventClient", () => { }; await eventClient.handleIncomingEvent(eventData); - const executions = await eventClient.getEventExecutions(handlerName, 0); - expect(Array.isArray(executions)).toBe(true); - expect(executions.length).toBeGreaterThan(0); + // Wait for event execution to be created (async processing) + let ourExecution; + const maxWaitTime = 30000; // 30 seconds + const pollInterval = 500; // 500ms + const startTime = Date.now(); + + while (Date.now() - startTime < maxWaitTime) { + const executions = await eventClient.getEventExecutions(handlerName, 0); + expect(Array.isArray(executions)).toBe(true); + + ourExecution = executions.find( + (exec) => exec.name === handlerName && exec.event === eventName + ); + + if (ourExecution) { + break; + } + + await new Promise((resolve) => setTimeout(resolve, pollInterval)); + } - // Find our execution in the results - const ourExecution = executions.find( - (exec) => exec.name === handlerName && exec.event === eventName - ); expect(ourExecution).toBeDefined(); expect(ourExecution?.name).toBe(handlerName); expect(ourExecution?.event).toBe(eventName); @@ -689,14 +717,29 @@ describe("EventClient", () => { }; await eventClient.handleIncomingEvent(eventData); - const response = await eventClient.getEventHandlersWithStats(0); - expect(response).toBeDefined(); - expect(response).toHaveProperty("results"); - expect(Array.isArray(response.results)).toBe(true); - expect(response.results?.length).toBeGreaterThan(0); + // Wait for statistics to be updated (async processing) + let foundHandler; + const maxWaitTime = 30000; // 30 seconds + const pollInterval = 500; // 500ms + const startTime = Date.now(); + + while (Date.now() - startTime < maxWaitTime) { + const response = await eventClient.getEventHandlersWithStats(0); + expect(response).toBeDefined(); + expect(response).toHaveProperty("results"); + expect(Array.isArray(response.results)).toBe(true); + expect(response.results?.length).toBeGreaterThan(0); + + // Find our handler in the results + foundHandler = response.results?.find((h) => h.event === eventName); + + if (foundHandler) { + break; + } + + await new Promise((resolve) => setTimeout(resolve, pollInterval)); + } - // Find our handler in the results - const foundHandler = response.results?.find((h) => h.event === eventName); expect(foundHandler).toBeDefined(); expect(foundHandler?.event).toBe(eventName); expect(foundHandler?.active).toBe(true); diff --git a/src/open-api/deprecated-types.ts b/src/open-api/deprecated-types.ts index 8a17519..5be2cc0 100644 --- a/src/open-api/deprecated-types.ts +++ b/src/open-api/deprecated-types.ts @@ -1,5 +1,6 @@ /* eslint-disable */ -// TODO: remove everything below (whole file) after April 2026 (backward compatibility types) +// Legacy compatibility types: This file provides backward compatibility types. +// These types are maintained for legacy users and will not be removed. // ------------------------------start------------------------------ import type { HumanTaskEntry, diff --git a/src/open-api/index.ts b/src/open-api/index.ts index 6dff367..f061d5c 100644 --- a/src/open-api/index.ts +++ b/src/open-api/index.ts @@ -54,14 +54,14 @@ export type { export * from "./types"; -// todo: remove after April 2026 (backward compatibility types) +// Legacy compatibility types: maintained for backward compatibility export * from "./deprecated-types"; /** * Export types needed for client's return type in case if user is building another lib on top of sdk with declaration files * @deprecated * to import all the types below manually while using SDK since these types could change in future without backward compatibility - * TODO: remove after April 2026 + * Legacy compatibility: maintained for backward compatibility */ export type { Auth, diff --git a/src/sdk/createConductorClient/createConductorClient.ts b/src/sdk/createConductorClient/createConductorClient.ts index 78fcec5..49c1401 100644 --- a/src/sdk/createConductorClient/createConductorClient.ts +++ b/src/sdk/createConductorClient/createConductorClient.ts @@ -41,6 +41,7 @@ export const createConductorClient = async ( await handleAuth(openApiClient, keyId, keySecret, refreshTokenInterval); } - // DEPRECATED, should be replaced with return openApiClient after April 2026: + // Legacy compatibility: Adds resource-based API methods for backward compatibility. + // The modern API is available directly on openApiClient, but legacy methods are maintained. return addResourcesBackwardCompatibility(openApiClient); }; diff --git a/src/sdk/createConductorClient/helpers/addResourcesBackwardCompatibility.ts b/src/sdk/createConductorClient/helpers/addResourcesBackwardCompatibility.ts index 6d22f6e..2c491b2 100644 --- a/src/sdk/createConductorClient/helpers/addResourcesBackwardCompatibility.ts +++ b/src/sdk/createConductorClient/helpers/addResourcesBackwardCompatibility.ts @@ -1,6 +1,7 @@ /* eslint-disable */ // disable linter since related old functionality was not properly typed -// TODO: everything in this file is DEPRECATED and whole file should be removed after April 2026 +// Legacy compatibility layer: This file provides backward compatibility for the old resource-based API. +// The legacy API is maintained for existing users, but new code should use the modern API methods. import type { SignalResponse } from "../../../open-api"; import type { Client } from "../../../open-api/generated/client/types.gen"; @@ -21,7 +22,7 @@ import { const warn = () => { console.warn( - "[Conductor SDK Deprecation Warning] Accessing resources directly on the client is deprecated and will be removed after April 2026" + "[Conductor SDK Legacy API] You are using the legacy resource-based API. This API is maintained for backward compatibility. For new code, use higher-level clients (EventClient, TaskClient) or Resource classes directly." ); };