Skip to content

feat: add support for event functions#111

Merged
macdonst merged 1 commit into
mainfrom
feat/RUN-1389
Jun 4, 2026
Merged

feat: add support for event functions#111
macdonst merged 1 commit into
mainfrom
feat/RUN-1389

Conversation

@macdonst

@macdonst macdonst commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Description

This is a step towards the unified defineFunction. For now I'm adding this sugar method defineEventFunction so that I can get the necessary types into @sanity/blueprints so that I can add events to blueprints-resource-function. These will be generic events without queue semantics.

What to review

defineEventFunction({
   name: 'send-email',
})

Testing

Added new tests to cover the new definer function.

Signed-off-by: Simon MacDonald <simon.macdonald@gmail.com>
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 96.44% 732 / 759
🔵 Statements 93.41% 795 / 851
🔵 Functions 91.66% 88 / 96
🔵 Branches 93.49% 704 / 753
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/definers/functions.ts 72.15% 77.41% 69.23% 74.24% 318-409, 442, 504, 516-524
src/types/functions/index.ts 100% 100% 100% 100%
src/validation/functions.ts 90.04% 90.18% 100% 100% 37, 38, 73, 74, 162, 163, 183, 184, 205, 206, 236, 237, 266, 267, 416, 417, 444, 445, 463, 493, 494
Generated in workflow #314 for commit 2a8164d by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

📚 TypeDoc Generation Result

TypeDoc generated successfully!

  • File size: 308K
  • Total exports: 210
  • Artifact: typedoc-564694a199faa9e98ca444cf1d4dcf23ac85caae
  • HTML docs preview: Download artifact

The TypeDoc JSON file has been generated and validated. All documentation scripts completed successfully.

@macdonst macdonst self-assigned this Jun 4, 2026
@macdonst macdonst requested a review from a team June 4, 2026 20:19
errors.push({type: 'invalid_value', message: '`type` must be `sanity.function.event`'})
}

errors.push(...validateFunction(functionResource))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why you add these errors at the end instead of at the beginning of the validation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't actually know why that is the last step before returning. I was just following the same convention as all the other validators in this file.

@macdonst macdonst merged commit 170d423 into main Jun 4, 2026
14 checks passed
@macdonst macdonst deleted the feat/RUN-1389 branch June 4, 2026 20:41
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.

2 participants