close
Skip to content

fix: accept readonly arrays for webhook eventTypes input#931

Merged
B4nan merged 1 commit into
masterfrom
feat/readonly-webhook-event-types
Jun 4, 2026
Merged

fix: accept readonly arrays for webhook eventTypes input#931
B4nan merged 1 commit into
masterfrom
feat/readonly-webhook-event-types

Conversation

@B4nan
Copy link
Copy Markdown
Member

@B4nan B4nan commented Jun 4, 2026

WebhookUpdateData.eventTypes — the input to create() / update() — now accepts a readonly WebhookEventType[]. The Webhook response type keeps eventTypes mutable, so this is input-only and not a breaking change for code that reads webhooks.

The client never mutates the array (it only appears in type declarations), and a readonly T[] still accepts a plain mutable T[], so:

  • Existing callers are unaffected — passing ['ACTOR.RUN.SUCCEEDED'] to create() / update() keeps working.
  • Callers holding a readonly array can now pass it directly. The Apify SDK types WebhookOptions.eventTypes as readonly WebhookEventType[], so it currently copies the array (eventTypes: [...options.eventTypes]) just to satisfy this client's mutable input type. With this change the copy goes away.

Emitted types after the change:

interface Webhook            { eventTypes: WebhookEventType[]; ... }          // response — mutable
type WebhookUpdateData = ... { eventTypes: readonly WebhookEventType[]; ... } // input — readonly

Type-only change; no runtime behavior changes. tsc build + lint pass.

🤖 Generated with Claude Code

@github-actions github-actions Bot added this to the 142nd sprint - Tooling team milestone Jun 4, 2026
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Jun 4, 2026
@B4nan B4nan changed the title feat: accept readonly arrays for webhook eventTypes fix: accept readonly arrays for webhook eventTypes Jun 4, 2026
@B4nan B4nan changed the title fix: accept readonly arrays for webhook eventTypes fix: accept readonly arrays for webhook eventTypes Jun 4, 2026
@B4nan B4nan added the adhoc Ad-hoc unplanned task added during the sprint. label Jun 4, 2026
@B4nan B4nan requested a review from barjin June 4, 2026 13:46
`WebhookUpdateData.eventTypes` (the input to `create()` / `update()`) now
accepts a `readonly WebhookEventType[]`. The client never mutates the array,
and `readonly T[]` still accepts a plain `T[]`, so existing callers are
unaffected — but callers holding a `readonly` array (e.g. the Apify SDK's
`WebhookOptions`) can pass it without copying first.

The `Webhook` response type keeps `eventTypes` mutable, so reading webhooks is
unchanged — this is input-only and not a breaking change.
@B4nan B4nan force-pushed the feat/readonly-webhook-event-types branch from d89cb55 to 2cd184b Compare June 4, 2026 13:53
@B4nan B4nan changed the title fix: accept readonly arrays for webhook eventTypes feat: accept readonly arrays for webhook eventTypes input Jun 4, 2026
@B4nan B4nan changed the title feat: accept readonly arrays for webhook eventTypes input fix: accept readonly arrays for webhook eventTypes input Jun 4, 2026
@B4nan B4nan merged commit 1737867 into master Jun 4, 2026
7 checks passed
@B4nan B4nan deleted the feat/readonly-webhook-event-types branch June 4, 2026 13:55
B4nan added a commit to apify/apify-sdk-js that referenced this pull request Jun 4, 2026
apify-client 2.23.4 types `WebhookUpdateData.eventTypes` as a readonly array
(apify/apify-client-js#931), so `Actor.addWebhook` can spread the readonly
`WebhookOptions.eventTypes` straight into `create()` without copying it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants