feat: add sdk.tasks module to @webiny/sdk#5106
Merged
Conversation
…15' into adrian/sdk-bg-tasks-2026-04-16 # Conflicts: # packages/pulumi-sdk/src/Pulumi.ts
sdk.tasks module to @webiny/sdk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
@webiny/sdknow exposes ataskssub-SDK (sdk.tasks) for interacting with Webiny's Background Tasks system from external applications. Developers can list registered task definitions, list task runs and their status, fetch execution logs (with optional filtering by task run ID), trigger new task executions, and abort running tasks — all through the sameResult-based API used by the rest of the SDK.The SDK playground (
app-sdk-playground) is updated with full ambient TypeScript declarations for the new module, giving in-browser editors full autocomplete and type checking forsdk.tasks.Why
There was no programmatic way to interact with Background Tasks from external apps using the SDK. The GQL API existed but required developers to write raw queries/mutations and handle the response envelope manually. The new
sdk.tasksmodule wraps those operations behind a consistent, type-safe interface that matches the existing SDK patterns.How
Added
packages/sdk/src/methods/tasks/containing five method files (listDefinitions,listTasks,listLogs,triggerTask,abortTask) plus a sharedtaskTypes.ts. A newTasksSdkclass (TasksSdk.ts) composes those methods and is wired into theWebinyclass assdk.tasks. All types are re-exported fromindex.ts.A notable detail: the
triggerTaskmutation usesWebinyBackgroundTaskDefinitionEnum!(notString!) for thedefinitionargument — this is enforced at the GraphQL schema level and must match a registered definition ID.The playground declaration file (
declarations/tasks.ts) addsSdkTasksand its supporting interfaces to the Monaco global ambient context.Changelog
Added Tasks SDK to
@webiny/sdkExternal applications can now interact with Webiny Background Tasks through the SDK. The new
sdk.tasksmodule lets you list task definitions and runs, retrieve execution logs, trigger new tasks, and abort running tasks — using the same type-safe Result API as the rest of the SDK.Squash Merge Commit