Skip to content

feat(admin): add onScheduleEffect wrapper for scheduled functions - #78

Draft
fwal wants to merge 1 commit into
mainfrom
claude/scheduled-functions-support-1lnmo2
Draft

feat(admin): add onScheduleEffect wrapper for scheduled functions#78
fwal wants to merge 1 commit into
mainfrom
claude/scheduled-functions-support-1lnmo2

Conversation

@fwal

@fwal fwal commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Closes #60

Summary

Adds an onScheduleEffect wrapper around firebase-functions/v2/scheduler's onSchedule, so scheduled functions (cron jobs) can run inside Effect like the other triggers.

export const cleanup = onScheduleEffect(
  { runtime, schedule: 'every 24 hours' },
  (event) => Effect.log(`Running cleanup job: ${event.jobName}`),
);

Details

  • Follows the existing wrapper conventions: runtime in the options object (matching onMessagePublishedEffect / onTaskDispatchedEffect, rather than the third-argument shape sketched in the issue), Effect.withSpan('onScheduleEffect') tracing, and defect logging via logger.error.
  • Scheduled events carry no payload, so there is no schema overload — a single signature receiving the ScheduledEvent (jobName, scheduleTime).
  • Exported from functions.ts, available as import { onScheduleEffect } from '@effect-firebase/admin'.
  • Docs: new "Scheduled (onSchedule)" section in the admin README, plus example and API reference entries in the create-firebase-function skill.

Validation

  • nx run @effect-firebase/admin:build
  • nx run @effect-firebase/admin:lint
  • nx run @effect-firebase/admin:test — 31/31 passing ✅
  • Prettier check on changed files ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01AEWBZud3svoJnGZZUStRcu


Generated by Claude Code

Adds an Effect wrapper around firebase-functions/v2/scheduler's onSchedule,
following the same conventions as the other trigger wrappers (runtime in
options, withSpan tracing, defect logging). Documents the new wrapper in
the package README and the create-firebase-function skill.

Closes #60

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AEWBZud3svoJnGZZUStRcu
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added 📖 docs Improvements or additions to documentation 📦 admin labels Aug 27, 2026
@fwal fwal added this to the 1.0 milestone Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 admin 📖 docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for onSchedule

1 participant