github emdash-cms/emdash @emdash-cms/plugin-types@0.5.0

latest releases: @emdash-cms/plugin-test@0.2.5, @emdash-cms/sandbox-workerd@0.9.0, @emdash-cms/plugin-embeds@0.1.52...
5 hours ago

Minor Changes

  • #3394 38d200d Thanks @ttmx! - Adds the byline:afterSave and byline:afterDelete plugin hooks, so plugins can keep external copies of author data, such as a search index, current when byline profiles change.

    Both hooks require the bylines:read capability and receive the same public byline profile that ctx.bylines.get() returns. byline:afterSave runs after a byline or one of its translations is created or updated, with isNew set on creation. byline:afterDelete receives the byline as it was before deletion. They run after changes made through the admin API or MCP tools, not seeds or imports, and hook errors are logged without undoing the change.

    Credit changes on an entry are still reported through content:afterSave. Relinking a byline to another user can change the credits inferred for that user's entries without a per-entry event.

  • #3394 38d200d Thanks @ttmx! - Adds the bylines:read plugin capability, which lets plugins read public byline profiles and the bylines credited on content entries through ctx.bylines.

    ctx.bylines provides get() and cursor-paginated list() for profiles, plus getEntriesBylines() for credits. getEntriesBylines() resolves up to 100 entries of one collection in a single call, so a search indexer or feed plugin can attach author names to a page of ctx.content.list() results:

    const page = await ctx.content.list("posts", { limit: 100 });
    const credits = await ctx.bylines.getEntriesBylines(
    	"posts",
    	page.items.map((entry) => entry.id),
    );

    Credits match what the site renders: the credits assigned in the editor, or the author's linked byline, marked source: "inferred", when an entry has none. They resolve at the entry's own locale. Profiles omit the linked user account, guest flag, and byline custom field values.

    The capability is independent of content:read and users:read. It is available to native plugins and to sandboxed plugins on Cloudflare Worker Loader and Node.js workerd. Installation and update consent list it as a new permission.

Don't miss a new emdash release

NewReleases is sending notifications on new releases.