Skip to content

feat: expose entries bulk action API via webiny package#5411

Open
adrians5j wants to merge 15 commits into
release/6.5.0from
adrian/entries-bulk-actions-2026-07-14
Open

feat: expose entries bulk action API via webiny package#5411
adrians5j wants to merge 15 commits into
release/6.5.0from
adrian/entries-bulk-actions-2026-07-14

Conversation

@adrians5j

Copy link
Copy Markdown
Member

Summary

Makes custom Headless CMS bulk actions authorable from a project via the public webiny meta-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 EntriesBulkAction backend 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 by generate-webiny-package):

Symbol(s) Alias
EntriesBulkAction, EntriesBulkActionConfig webiny/api/cms/bulk-actions
BulkActionFeature, BulkActionUseCase webiny/admin/cms/entry/list
BulkActionButton, useBulkActionDialog webiny/admin

Demo

extensions/backgroundTasksDemo/ — an "Apply Discount" bulk action on a Products model:

  • Backend (ApplyDiscountBulkAction.ts) — a custom EntriesBulkAction (loadData + processData). Webiny generates its background task + GraphQL mutation.
  • Frontend (ApplyDiscountAction.tsx) — a BulkActionButton that triggers the action via BulkActionUseCase, scoped to the current selection.

Serves as a runnable example exercising the newly-exposed API.

Verification

  • webiny package regenerated + rebuilt; all three aliases require.resolve to dist.
  • Demo (backend + frontend + models) typechecks clean against the built webiny dist (the same way the extension build resolves it).
  • yarn lint clean, yarn format applied.

🤖 Generated with Claude Code

adrians5j and others added 15 commits July 14, 2026 14:50
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant