feat: expose entries bulk action API via webiny package#5411
Open
adrians5j wants to merge 15 commits into
Open
feat: expose entries bulk action API via webiny package#5411adrians5j wants to merge 15 commits into
adrians5j wants to merge 15 commits into
Conversation
Allow projects to author custom Headless CMS bulk actions (which Webiny
runs as background tasks) using the public `webiny` meta-package:
- api: `EntriesBulkAction`, `EntriesBulkActionConfig` via `webiny/api/cms/bulk-actions`
- admin: `BulkActionFeature`, `BulkActionUseCase` via `webiny/admin/cms/entry/list`
- admin: `BulkActionButton`, `useBulkActionDialog` via `webiny/admin`
Includes a background-tasks demo extension ("Apply Discount" bulk action
on Products) exercising the exposed API end to end.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- ApplyDiscountBulkAction.loadData filters `onSale_not: true` and processData sets `onSale: true`, so the background task converges instead of re-listing the same entries forever (was failing at maxIterations = 500). - Add `onSale` boolean to the Product model (the convergence flag). - Restore `exclude` accidentally dropped from create-webiny-project/tsconfig.build.json by the tsconfig generator. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Demo (extensions/backgroundTasksDemo): - Fix bulk-action convergence filter to use the storage-level `values.` path (`values.onSale_not`) so the custom field resolves; a bare `onSale_not` threw "There is no field with the fieldId onSale". - `processData` sets `skipValidation` on the update so a targeted price change isn't blocked by unrelated required fields on the entry. - Emit `cms.product.discountApplied` over websockets per processed entry, and add a frontend `WebsocketEventHandler` that toasts on receipt. - Toast immediately when the confirmation dialog is confirmed (task started). Exposition (webiny meta-package): - `WebsocketEventHandler` -> `webiny/admin/websockets` - `Notifications` -> `webiny/admin` Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace console.warn with the DI-injected `Logger` for the best-effort websocket-notification failure path. Also trims the README after the api/admin reorg. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"Generate AI summary" bulk action on Products that runs as a background task and delegates generation to AI Power Ups (configured provider + optional Project / Writer Persona / Reader Persona, picked from a dropdown). Per-run token convergence allows re-summarizing the same entries. Emits a per-entry websocket notification (toast on the client). Exposes CmsGenerateEntryContentUseCase (webiny/api/ai-powerups) and the admin GetSettingsFeature (webiny/admin/ai-powerups). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Makes custom Headless CMS bulk actions authorable from a project via the public
webinymeta-package. A custom bulk action is auto-run by Webiny as a background task, so this also demonstrates the background-tasks flow end to end.Previously the
EntriesBulkActionbackend API and the 6.5.0 bulk-action frontend primitives were internal-only — projects had no blessed way to add their own bulk action.Exposed API
Declared in each owning package's
src/exports/**(merged bygenerate-webiny-package):EntriesBulkAction,EntriesBulkActionConfigwebiny/api/cms/bulk-actionsBulkActionFeature,BulkActionUseCasewebiny/admin/cms/entry/listBulkActionButton,useBulkActionDialogwebiny/adminDemo
extensions/backgroundTasksDemo/— an "Apply Discount" bulk action on a Products model:ApplyDiscountBulkAction.ts) — a customEntriesBulkAction(loadData+processData). Webiny generates its background task + GraphQL mutation.ApplyDiscountAction.tsx) — aBulkActionButtonthat triggers the action viaBulkActionUseCase, scoped to the current selection.Serves as a runnable example exercising the newly-exposed API.
Verification
webinypackage regenerated + rebuilt; all three aliasesrequire.resolvetodist.webinydist (the same way the extension build resolves it).yarn lintclean,yarn formatapplied.🤖 Generated with Claude Code